Reputation: 11753
I give the following codes to make my question more clear:
bool bFind;
boost::tuple<int> abc;
//int abc;
std::vector<boost::tuple<int> > myArray;
//std::vector<int> myArray;
bFind = is_vector_contains(myArray,abc);
is_vector_contains is template function:
template<typename T>
bool is_vector_contains(const std::vector<T> &vecArray, const T &element)
{
if(std::find(vecArray.begin(),vecArray.end(),element) == vecArray.end())
return false;
else
return true;
}
When I compile the above codes, I have the following compilation error:
Error 1 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const boost::tuples::tuple<T0>' (or there is no acceptable conversion)
Any ideas? I tried to define a equal operator in this way, but it did not succeed in compilation.
bool operator == (const boost::tuple<int> &a, const boost::tuple<int> &b)
{
return true;
}
Upvotes: 0
Views: 52
Reputation: 227458
boost::tuple
's comparison operators are defined in a separate header, which you must include:
#include <boost/tuple/tuple_comparison.hpp>
Upvotes: 1