I have a container object:
R Container;
R is of type list<T*>orvector<T*>
I am trying to write the following function:
template<typename T, typename R>
T& tContainer_t<T, R>::Find( T const item ) const
{
typename R::const_iterator it = std::find_if(Container.begin(), Container.end(), [item](const R&v) { return item == v; });
if (it != Container.end())
return (**it);
else
throw Exception("Item not found in container");
}
When trying a method (v is an object of my class)
double f = 1.1;
v.Find(f);
I get binary '==' : no operator found which takes a left-hand operand of type 'const double' (or there is no acceptable conversion)
I am confused with the lambda expression syntax and what I should write there, and could not find any friendly explanation.
What's wrong? 10x
source
share