I am implementing the Open List (OL) class for the A* search algorithm. The OL is basically a specialized priority queue of search nodes. It is common to see a notation like this in the pseudo-code describing the A* algorithm:
successorNode -> OL // put the successor node into OL
...
curNode <- OL // get the best node from OL and store it in curNode
Three questions:
-
Would it make sense for my OL class to support a similar notation by overloading the shift operators:
OL ol; ... OL << successorNode; ... OL >> curNode; -
(Only if the answer to 1. is "Yes") Can I go as far as to support this (i.e. the usage not supported by
coutandcinfor the built-in types):OL ol; ... successorNode >> OL; ... curNode << OL; -
(Only if the answer to 1. is "Yes") Would this usage of the shift operators make sense for standard containers:
vector<int> v; v << 5; // instead of v.push_back(5)
Aucun commentaire:
Enregistrer un commentaire