Re: [Boost-bugs] [Boost C++ Libraries] #12876: BOOST_CHECK_EQUAL fail for vector<int> with operator<< for vector<T>

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12876: BOOST_CHECK_EQUAL fail for vector<int> with operator<< for vector<T>
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-03-02 08:07:11


#12876: BOOST_CHECK_EQUAL fail for vector<int> with operator<< for vector<T>
-------------------------------+---------------------
  Reporter: 401819174@… | Owner: rogeeff
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: test
   Version: Boost 1.61.0 | Severity: Problem
Resolution: invalid | Keywords:
-------------------------------+---------------------

Comment (by renficiaud):

 I do not understand everything you are saying (please use the Wiki
 Markup), but here is what I think:

 {{{
 const std::vector<int> a{1};
 const std::vector<int> b{2};
 BOOST_CHECK_EQUAL(a, b); /* does not work. */
 }}}

 This does not work because it requires {{{std::vector<int>}}} to be
 printable, which is usually never the case by default. However

 {{{
 BOOST_CHECK_EQUAL_COLLECTIONS(a.begin(), a.end(), b.begin(), b.end());
 }}}

 works as expected, because the underlying {{{int}}} is already printable.

 Concerning
 {{{
 std::vector<PrintClass> c{PrintClass()};
 std::vector<PrintClass> d{PrintClass()};
 BOOST_CHECK_EQUAL(c, d);
 }}}
 In your example, this works because you have this template that is capture
 the prints to std::cout:
 {{{
 template <typename T> std::ostream & operator<< (
     std::ostream & os,
     std::vector<T> const &v)
 }}}

 Your bug is invalid.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12876#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-03-02 08:11:26 UTC