[C++-sig] `cout << tuple` is ambiguous

Holger Brandsmeier brandsmeier at gmx.de
Sun Aug 26 22:04:07 CEST 2012


Dear list,

I get the following error
 error: use of overloaded operator '<<' is ambiguous (with operand
types 'basic_ostream<char, std::char_traits<char> >' and
      'const boost::python::tuple')

The two candidates are an output operator for tuple, which I want to use

/usr/include/boost-1_48/boost/python/object_operators.hpp:105:1: note:
candidate function [with L =
      std::basic_ostream<char>, R = boost::python::tuple]
BOOST_PYTHON_BINARY_OPERATOR(<<)

/usr/include/boost-1_48/boost/python/object_operators.hpp:90:36: note:
expanded from macro
      'BOOST_PYTHON_BINARY_OPERATOR'
BOOST_PYTHON_BINARY_RETURN(object) operator op(L const& l, R const& r)  \


And an output operator for bools

/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/ostream:172:7:
note: candidate function
      operator<<(bool __n)


How do I avoid this ambiguity with booleans? And how can I output tuples?

Btw. the compiler that I used is `clang version 3.1 (trunk 154212)`

Best regards,
Holger Brandsmeier


More information about the Cplusplus-sig mailing list