Boost Variant OutputStreamable
I have started using Boost recently, and though I should switch my own variant to the Boost Variant . However I cannot compile the following code #include<iostream> #include<vector> #include<string> #include<boost/variant.hpp> std::basic_ostream<char> &operator<<(std::basic_ostream<char> &theostream,const std::vector<unsigned long> &theVector) { for(unsigned long i(0);i<theVector.size();i++) theostream << theVector[i] << "\n" ; return theostream; } struct TpTemplateVariant { typedef boost::variant< int, unsigned long, double, bool, std::string, std::vector<unsigned long>
BoostVariant;
}; typedef TpTemplateVariant::BoostVariant Tpvariant; int main () { Tpvariant p(5); std::cout << p; return 0; } The error I get is error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const T5'
participants (1)
-
Nindi