Skip to content

Tests unittests/map.cpp compile error under VS2013/VS2015 with boost 1.6X #280

Closed
@stevehickman

Description

VS apparently does not define stream operators for std::pair. Compiling map.cpp results in:

map.cpp
1>d:\boost\boost_1_61_0_b1\boost\test\tools\detail\print_helper.hpp(47): error C2338: Type has to implement operator<< to be printable
1>  d:\boost\boost_1_61_0_b1\boost\test\tools\detail\print_helper.hpp(178): note: see reference to class template instantiation 'boost::test_tools::tt_detail::print_log_value<T>' being compiled
1>          with
1>          [
1>              T=std::pair<const std::string,int>
1>          ]
1>  d:\boost\boost_1_61_0_b1\boost\test\utils\wrap_stringstream.hpp(66): note: see reference to function template instantiation 'std::ostream &boost::test_tools::tt_detail::operator <<<std::pair<const _Kty,_Ty>>(std::ostream &,const boost::test_tools::tt_detail::print_helper_t<std::pair<const _Kty,_Ty>> &)' being compiled
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=int
1>          ]
1>  d:\boost\boost_1_61_0_b1\boost\test\tools\old\impl.hpp(213): note: see reference to function template instantiation 'boost::basic_wrap_stringstream<char> &boost::operator <<<char,boost::test_tools::tt_detail::print_helper_t<std::pair<const _Kty,_Ty>>>(boost::basic_wrap_stringstream<char> &,const T &)' being compiled
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=int,
1>              T=boost::test_tools::tt_detail::print_helper_t<std::pair<const std::string,int>>
1>          ]

One way to eliminate this problem is to add the following to the top of map.cpp:

typedef  std::pair<const std::string, int>       str_int_map_type;
BOOST_TEST_DONT_PRINT_LOG_VALUE(StructBase)
BOOST_TEST_DONT_PRINT_LOG_VALUE(str_int_map_type)

See this [link ](http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/test_output/testing_tool_output_disable.html)for documentation.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions