|
Boost Users : |
From: Josue Gomes (josue.gomes.honeypot_at_[hidden])
Date: 2005-11-23 07:32:17
Hi,
Take this code:
#include <string>
#include <boost/tuple/tuple.hpp>
struct A {};
bool operator==(A, A) { return true; }
int main()
{
using namespace boost;
tuple<std::string, int, A> t1(std::string("same?"), 2, A());
tuple<std::string, long, A> t2(std::string("same?"), 2, A());
tuple<std::string, long, A> t3(std::string("different"), 3, A());
t1 == t2; // error: no match for operator==
t1 == t3; // error: no match for operator==
}
This is similar to the example shown in Boost.Tuple docs. However the
compiler(*) refuses to compile it.
I tried it with versions 1.33.0 and 1.33.1 (Beta)
Any ideas?
Compiler outputs below:
MSC C/C++ Compiler 13.10;3077
cl /GR /EHsc /IE:\projects\libraries\boost_1_33_1 tuple_error.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
tuple_error.cpp
tuple_error.cpp(17) : error C2678: binary '==' : no operator found which takes a
left-hand operand of type 'boost::tuples::tuple<T0,T1,T2>' (or there is no acce
ptable conversion)
with
[
T0=std::string,
T1=int,
T2=A
]
tuple_error.cpp(18) : error C2678: binary '==' : no operator found which takes a
left-hand operand of type 'boost::tuples::tuple<T0,T1,T2>' (or there is no acce
ptable conversion)
with
[
T0=std::string,
T1=int,
T2=A
]
gcc 3.4.4
g++ -I E:\projects\libraries\boost_1_33_1 tuple_error.cpp -o
tuple_error_gcc.exe
tuple_error.cpp: In function `int main()':
tuple_error.cpp:17: error: no match for 'operator==' in 't1 == t2'
tuple_error.cpp:7: note: candidates are: bool operator==(A, A)
tuple_error.cpp:18: error: no match for 'operator==' in 't1 == t3'
tuple_error.cpp:7: note: candidates are: bool operator==(A, A)
Regards,
Josue
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