Re: VS 2013, operator<< для вложенного класса-потомка включающего класса
От: frymode  
Дата: 08.12.14 09:37
Оценка: 1 (1)
Здравствуйте, godplayer, Вы писали:

G>nested.cpp(34): error C2676: binary '<<' : 'module_error::bad_config' does not define this operator or a conversion to a type acceptable to the predefined operator

G>Можно ли это как-то побороть?

Вроде бы по стандарту необходимо реализовывать свободную функцию вне класса:

class base_exception
{
public:
    template <class E> friend E const& operator<<(E const& ex, std::string const& str);
    ...
private:
    mutable std::string m_what;
};

template <class E> E const& operator<<(E const& ex, std::string const& str)
{
    ex.m_what += str;
    return ex;
}
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.