Firstly , I apologise if you do not find this a proper question
I stumbled across a resume which has the below detail
I almost always wanted to do something simple enough and specific enough not to warrant a totally new function, but doing the iteration by hand every time is messy and error- prone, so I built a predicated iterator that enabled me to retain the structure of a traditional for-loop:
for (/* loop control */)
{
/* operation */
}
Specifically, it allows things like:
for (tree_iterator i (root, SomePredicate); i; ++i)
{
i->SomeOperation();
i->AnotherOperation();
}
"This way the iteration mechanics are factored out and kept together, and the body of the loop is devoted to the operation. I've found this to be a useful tool when dealing with my object hierarchies. It allows for very complicated iterations to be represented clearly with all the appropriate parts abstracted."
Can someone throw some light on what a predicating iterator is or any detail on how it could be implemented and how it works ?
Thanks for your time , Apologies if this is a wrong question .
Aucun commentaire:
Enregistrer un commentaire