I've got a std::map that contains a class and that class has an id. I have an id that I'm trying to find in the set
typedef std::set<LWItem> ItemSet; ItemSet selectedItems; LWItemID i = someID; ItemSet::iterator isi; isi = std::find_if(selectedItems.begin(), selectedItems.end(), [&a](LWItemID i)->bool { return a->GetID()==i; } I get an error saying that the lambda capture variable is not found, but I have no idea what I'm supposed to do to get it to capture the container contents as it iterates through. Also, I know that I cant do this with a loop, but I'm trying to learn lambda functions.
a? What are you searching in?maporset?selectedItemsis a container ofLWItems, so the lambda can't take anLWItemIDas an argument. It has to take anLWItem(possible aconst &)LWItemvariable,i, and the element being iterated viastd::find_if.