Boost logo

Boost Users :

From: Frank Birbacher (bloodymir.crap_at_[hidden])
Date: 2004-11-21 13:15:01


Hi!

Bo Peng wrote:
> However, I can not output a variant vector work by defining ostream&
> operator<< vector<double> . Attached is a test case. Note that variant
> int, string can be outputed, but not the vector. Yet, cout <<
> vector<double> is working.

The problem is not in the variant itself, but it the function
lookup of C++: Your operator << is neither defined in the
namespace of the ostream (which is std::) nor defined in the
namespace from where it is called (which is boost::). That's why
the compiler does not find your function when using the variant.
   You must not put anything into the std namespace but function
overloads AFAIK. So try to put your operator << into the
namespace std. You can search throu the newsgroup
comp.lang.cpp.moderated for further information.

Frank


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net