"Gennadiy Rozental" wrote in message
news:loom.20100206T071834-814@post.gmane.org...
You can send in a patch which will make Boost.Test work with both ostream
and
wostream. Also you cna write an operator << (ostream&,wstring const&)
I tried to put the operator above "#include ", but
the same error persists, and mine is not in the candidate operator overload
list displayed in the message - only operators defined in <ostream> are
listed. My operator lets me output wstrings to std::cout from test cases,
but when "boost\test\test_tools.hpp" tries to do it, it does not compile.
I am using boost 1.41.0 and vc9. Here is my code and the error:
#include <iostream>
#include <string>
std::ostream & operator << (std::ostream & stream, const std::wstring & str)
{
return stream << "std::wstring";
}
#define BOOST_TEST_MODULE const_string test
#include
BOOST_AUTO_TEST_CASE(Test)
{
std::wstring wstr;
std::cout << wstr; // OK
BOOST_CHECK_EQUAL(wstr, wstr); // Error
}
test.cpp
...\boost\test\test_tools.hpp(326) : error C2679: binary '<<' : no operator
found which takes a right-hand operand of type 'const std::wstring' (or
there is no acceptable conversion)
...
while trying to match the argument list '(std::ostream, const
std::wstring)'
...\boost\test\test_tools.hpp(318) : while compiling class template
member function 'void boost::test_tools::print_log_value<T>::operator
()(std::ostream &,const T &)'
with
[
T=std::wstring
]