Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-08-18 00:16:39


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_at_[hidden]> wrote in message news:D0D608FD34E14C4BA93A30AC162651E11F3B97_at_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_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net