c++ - Overloading insertion operator in Boost.Log (Boost 1.60.0) -
i trying overload operator<< can log vector<t>s in boost.log. tried overloading formatting_ostream:
template <typename t> inline boost::log::formatting_ostream &  operator<< (boost::log::formatting_ostream & o, const std::vector<t> & v) {     return o; }   this not compile boost 1.60.0
i using following logger:
typedef boost::log::sources::severity_logger<     boost::log::trivial::severity_level > my_logger_t;   the errors see are:
.../boost_1_60_0/build/include/boost/log/utility/formatting_ostream.hpp:799:19:
error: no match
operator<<(operand typesboost::log::v2s_mt_posix::basic_formatting_ostream<char>::ostream_type {aka std::basic_ostream<char>},const std::vector<int>)strm.stream() << value
as understand, overloading doesn't work!! because compiler still calling pre-defined operator<< makes strm.stream() << value call.
am doing wrong? what's best way go this?
thanks!
this looks adl problem: since operator<< in neither boost::log nor std namespaces, doesn't picked during name lookup.
Comments
Post a Comment