On Sat, Jul 11, 2009 at 1:01 PM, Archie14
Can't figure out the proper sintax for binding <<.
class A { public: friend std::ostream& operator << (std::ostream& stream, A& a); };
class B : boost::ptr_vector<A> { public: friend std::ostream& operator << (std::ostream& stream, B& b); }
std::ostream& operator << (std::ostream& stream, B& b) { std::for_each(begin(), end(), boost::bind(&operator<<, ref(stream), ref(_1)); ??? return stream; }
Is that code snippet real code? Or did you mean std::ostream& operator << (std::ostream& stream, B& b) { std::for_each(b.begin(), b.end(), boost::bind(&operator<<, ref(stream), ref(_1)); ??? return stream; } Also, deriving from std containersis not a good move as they aren't dsigned for it. I presume the same is true for boost::ptr_vector. - Rob.