Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-07-25 12:58:44


Hi,

With the following test case:

#include <boost/array.hpp>

template<typename T,size_t N>
std::ostream operator<<(const std::ostream & os, const boost::array<T,N> & arr)
{
    os << "[ ";
    for(size_t i = 0 ; i < N-1; ++i)
    {
        os << arr[i] << ", ";
    }
    os << arr[N-1] << " ]";
    return os;
}

BOOST_AUTO_UNIT_TEST ( test_boost_test_array )
{
    boost::array<double,3> arr1[] = {
        {{1,0,0}},
        {{1,2,2}}
    };

    boost::array<double,3> arr2[] = {
        {{1,0,0}},
        {{1,2,2}}
    };

    BOOST_REQUIRE_EQUAL_COLLECTIONS(arr1,arr1+2,
                                    arr2,arr2+2);
}

I'm getting odd compile errors at this line:

res.message() << "\nMismatch in a position " << pos << ": " << *left_begin << " != " << *right_begin;

gcc.compile.c++ bjam-build/gcc/release/unit_tests/data_utils.o
external/boost/include/boost/test/utils/wrap_stringstream.hpp: In function âboost::basic_wrap_stringstream<CharT>& boost::operator<<(boost::basic_wrap_stringstream<CharT>&, const T&) [with CharT = char, T = boost::array<double, 3u>]â:
external/boost/include/boost/test/test_tools.hpp:495: instantiated from âboost::test_tools::predicate_result boost::test_tools::tt_detail::equal_coll_impl(Left, Left, Right, Right) [with Left = boost::array<double, 3u>*, Right = boost::array<double, 3u>*]â
unit_tests/data_utils.cpp:62: instantiated from here
external/boost/include/boost/test/utils/wrap_stringstream.hpp:66: error: no match for âoperator<<â in â(+ targ)->boost::basic_wrap_stringstream<CharT>::stream [with CharT = char]() << tâ

What am I missing here?

Sorry for the long email!

TIA,

Sohail


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk