Given a std:: list
std::list< int > myList
and one element in that list
myElement
How can I get an std::list::iterator to that element efficiently?
A slow yet working example is
const_iterator it
for( it = myList.begin(); it != &myElement; ++it)
{
// do nothing, for loop terminates if "it" points to "myElem"
}
Is there a quicker way? like
const_iterator it = magicToIteratorConverter( myList, myElem )
Aucun commentaire:
Enregistrer un commentaire