-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace for-iterator loops with for-each loops and algorithm functions under libs/ #949
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be very dangerous to do automatically. Perhaps the sed replacements handle it, but there are container-specific cases where erase invalidates the iterator and the code structure doesn't allow for i = container.erase()
Also, I don't see the point in using a type in the for loop if these changes are made. Why not just for (auto & i : container) { ... } ?
or better yet with explicit const |
for loops are one of the only good uses for |
for (const std::pair<const string, string>& m : cd_info) { | ||
node->add_child_nocopy(cd_info_node(m.first, m.second)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual modern way is
for (const std::pair<const string, string>& m : cd_info) { | |
node->add_child_nocopy(cd_info_node(m.first, m.second)); | |
for (auto&& [some_stuff, another_thing] : cd_info) { | |
node->add_child_nocopy(cd_info_node(some_stuff, another_thing)); |
picking the right names obviously.
cadf627
to
4c67991
Compare
…op in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]\*[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4(?:\.|->)end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (std::pair<\1* const&,\2>& \3 : \4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4(?:\.|->)end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (std::pair<const \1,\2>& \3 : \4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]\*[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (std::pair<\1* const&,\2>& \3 : *\4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4(?:\.|->)end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (std::pair<const \1,\2>& \3 : *\4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]\*[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (std::pair<\1* const&,\2>& \3 : *this) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (std::pair<const \1,\2>& \3 : *this) { Any dereferencing of the loop internal variable has to be removed manually.
…ach loop in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]\*[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (const std::pair<\1* const&,\2>& \3 : \4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (const std::pair<const \1,\2>& \3 : \4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]\*[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (const std::pair<\1* const&,\2>& \3 : *\4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*\4->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (const std::pair<const \1,\2>& \3 : *\4) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]\*[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (const std::pair<\1* const&,\2>& \3 : *this) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?map<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n],[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\3[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\3|\3\+\+)\)[ \t\n]*\{ -> for (const std::pair<const \1,\2>& \3 : *this) { Any dereferencing of the loop internal variable has to be removed manually.
… loop in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1& \2 : *\3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1& \2 : *this) { Any dereferencing of the loop internal variable has to be removed manually.
…r-each loop in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : *\3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : *\3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : *this) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?vector<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : this) { Any dereferencing of the loop internal variable has to be removed manually.
…op in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : *this) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : *this) { Any dereferencing of the loop internal variable has to be removed manually.
…ach loop in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : *this) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?set<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : *this) { Any dereferencing of the loop internal variable has to be removed manually.
…oop in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1& \2 : *\3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1& \2 : *this) { Any dereferencing of the loop internal variable has to be removed manually.
…each loop in libs/ Regex substitutions have to be run in the following order: for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)\.begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3\.end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : \3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : *\3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*(.*)->begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*\3->end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : *\3) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*\*[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (\1* const& \2 : *this) { for[ \t\n]*\([ \t\n]*(?:typename )?[ \t\n]*(?:std::)?list<[ \t\n]*(?:typename )?[ \t\n]*(?:struct )?[ \t\n]*(.*)[ \t\n]*>::const_iterator[ \t\n]+(.*)[ \t\n]*=[ \t\n]*begin[ \t\n]*\(\);[ \t\n]*\2[ \t\n]*(?:<|!=)[ \t\n]*end[ \t\n]*\(\);[ \t\n]*(?:\+\+\2|\2\+\+)\)[ \t\n]*\{ -> for (const \1& \2 : this) { Any dereferencing of the loop internal variable has to be removed manually.
4c67991
to
e970725
Compare
No description provided.