Michiel Helvensteijn wrote:
John C. Femiani wrote:
or to specialize boost::test_tools::tt_detail::print_log_value.
This I didn't try. It seemed a bit more hack-ish and a bit more work.
Well both legal solutions involve using something from a 'detail' namespace, which scares me.
Hm, yes. You're afraid they will change the structure of that namespace from under our feet without even putting it in a changelog.
Given that possibility, might it not be better to put it in namespace std anyway...
Perhaps they should offer us a real solution in the next version?
Perhaps an overloadable ::boost::repr(T) function that translates T into a proxy type that can have operator<< overloaded properly. e.g. (untested) namespace boost{ template<class T> T const & repr(T const & arg) { return arg; } } namespace boost{ template<class T> std::string repr(std::vector<T> const& arg) { std::ostringstream dst; typename std::vector<T>::iterator i = arg.begin() dst << '{' << repr(*i++); while(i != arg.end()) dst << ',' << repr(*i++); dst << '}'; return dst.str(); } } BTW: I think you can write a ::boost::iterator_range to a stream. (haven't tried from a test macro though). I bet that would be useful for test, program_options, lexical_cast, etc. (If something similar does not already exist). --John