I'm trying to find an object with some attribute value in a custom container that contains an array of objects of another class.
MyIterator<WindowWithTitleButton> WindowList::FindTitle(string title_find)
{
auto iter = std::find(this->begin(), this->end(), title_find);
return iter;
}
"Title" is an attribute of class WindowWithTitleButton
and I'm trying to find object in the container with that "title", but I can't figure out how.
I tried to do that with std::find_if
bool WindowList::ContainsTitle(string cmpr, string title)
{
int result = cmpr.compare(title);
if (result == 0)
return true;
else
return false;
}
MyIterator<WindowWithTitleButton> WindowList::FindTitle(string title_find)
{
MyIterator<WindowWithTitleButton> iter;
auto i = std::find_if(iter = begin(), iter = end(), ContainsTitle((*iter).GetTitle(),title_find));
return i;
But it gives me an error C2064 - term does not evaluate to a function taking 1 arguments. How can I properly use this function without error?