[Boost.Test] How to handle std::valarray<> w/ BOOST_CHECK or BOOST_CHECK_EQUAL

Hello, I am using the Boost.Test framework, but I not able to use std::valarray<> with BOOST_CHECK or BOOST_CHECK_EQUAL macro. For example: <\code> static void print_valarray(std::ostream& os, std::valarray<double> const& v) { // TODO } namespace std { std::ostream& operator<< (std::ostream& os, std::valarray<double> const& v) { print_valarray(os, v) ; return os ; } } ; std::valarray<double> v(10) ; BOOST_CHECK_EQUAL(v, v); <\code> Failed with the following compilation error: c:\Dev\MViala\ADV\Library\boost-1_33_1\boost\test\predicate_result.hpp(51): error C2664: 'boost::test_tools::predicate_result::readonly_property57::readonly_property57(const boost::test_tools::predicate_result::readonly_property57::write_param_t)' : impossible de convertir le paramètre 1 de 'std::_Boolarray' en 'const boost::test_tools::predicate_result::readonly_property57::write_param_t' Configuration: Platform: Win32 Compiler: Microsoft Visual C++ version 7.1 STL : Dinkumware standard library version 313 Boost : 1.33.1 Any help will be appreciated... Marc Viala

operator==( std::valarray<double> const&, std::valarray<double> const& ) returns std::valarray<bool> which is not bool convertible value You will either have to use by element comparison or write your own predicate that compare the valarrays BOOS_CHECK_PREDICATE( my_valarray_comp, (v1)(v2) ); Gennadiy "Marc Viala" <mviala@acticm.com> wrote in message news:D0D608FD34E14C4BA93A30AC162651E11F3B97@SERVEUR2003.acticm.com... Hello, I am using the Boost.Test framework, but I not able to use std::valarray<> with BOOST_CHECK or BOOST_CHECK_EQUAL macro. For example: <\code> static void print_valarray(std::ostream& os, std::valarray<double> const& v) { // TODO } namespace std { std::ostream& operator<< (std::ostream& os, std::valarray<double> const& v) { print_valarray(os, v) ; return os ; } } ; std::valarray<double> v(10) ; BOOST_CHECK_EQUAL(v, v); <\code> Failed with the following compilation error: c:\Dev\MViala\ADV\Library\boost-1_33_1\boost\test\predicate_result.hpp(51): error C2664: 'boost::test_tools::predicate_result::readonly_property57::readonly_property57(const boost::test_tools::predicate_result::readonly_property57::write_param_t)' : impossible de convertir le paramètre 1 de 'std::_Boolarray' en 'const boost::test_tools::predicate_result::readonly_property57::write_param_t' Configuration: Platform: Win32 Compiler: Microsoft Visual C++ version 7.1 STL : Dinkumware standard library version 313 Boost : 1.33.1 Any help will be appreciated. Marc Viala ------------------------------------------------------------------------------ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Gennadiy Rozental
-
Marc Viala