Hi,
I have the following code which comples:
bool contains(vector<A*>& cgl, A* cg) {
vector<A*>::iterator iter = find_if ( cgl.begin(), cgl.end(), bind(
equal_to<A*>(), _1, cg ));
return (iter != cgl.end());
}
anb how I want to create a template of the above code:
template<class T1, class T2>
bool contains(T1& cgl, T2 cg) {
// this is line 189 of Utils.h
T1::iterator iter = find_if ( cgl.begin(), cgl.end(),
boost::lambda::bind( equal_to<T2>(), boost::lambda::_1, cg ));
return (iter != cgl.end());
}
but I have the compile error:
.../Utils.h: In function 'bool contains(T1&, T2)':
.../Utils.h:189: error: expected `;' before 'iter'
.../Utils.h:191: error: 'iter' was not declared in this scope
Thanks for any idea.