id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 5783,lexical_cast fails for types whose operator<> are templated on stream type,gredner@…,Antony Polukhin,"The following code does not compile: {{{ #include #include #include struct Foo { Foo() : f(2) {} int f; }; template OStream& operator<<(OStream& ostr, const Foo& foo) { ostr << foo.f; return ostr; } int main() { Foo foo; // OK! std::cout << foo << std::endl; // Does not compile! std::cout << boost::lexical_cast(foo) << std::endl; } }}} The problem is that inside lexical_cast there is a stream-like type called lexical_stream_limited_src which has a bunch of operator<< overloads which all return bool, and the rest of the implementation relies on these being called, and treats ""x << y"" expressions as returning bool. However, in the example above, such expressions match the template operator<< instead. I ran into this because boost::fusion uses operator<