Skip to content

Instantly share code, notes, and snippets.

@ahankinson
Created August 10, 2011 18:13
Show Gist options
  • Save ahankinson/1137670 to your computer and use it in GitHub Desktop.
Save ahankinson/1137670 to your computer and use it in GitHub Desktop.
comparing pointers
bool MeiElement::hasChild(MeiElement *child) {
for (vector<MeiElement*>::iterator iter = _children.begin(); iter != _children.end(); ++iter) {
if((&child) == &(*iter)) {
return true;
}
}
return false;
}
@tmatth
Copy link

tmatth commented Aug 10, 2011

include

bool MeiElement::hasChild(MeiElement *child) const
{
return std::find(children_.begin(), children_.end(), child) != children_.end();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment