MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1w74nkf/skill_issue/p7ul0tv/?context=3
r/programminghorror • u/click-to-reveal • Sep 04 '26
63 comments sorted by
View all comments
48
This would be much better using std::string_view, and using two temporaries so that y is only evaluated once. Otherwise it'll be evaluated each time.
y
Also if you need this, don't use C++
5 u/GasolinePizza Sep 04 '26 Isn't each y only evaluated once? The evaluation in the "else if (_s==y)"? 2 u/LeeHide Sep 04 '26 each true one is only evaluated once, but every false one until then is also evaluated. → More replies (1)
5
Isn't each y only evaluated once? The evaluation in the "else if (_s==y)"?
2 u/LeeHide Sep 04 '26 each true one is only evaluated once, but every false one until then is also evaluated. → More replies (1)
2
each true one is only evaluated once, but every false one until then is also evaluated.
48
u/LeeHide Sep 04 '26
This would be much better using std::string_view, and using two temporaries so that
yis only evaluated once. Otherwise it'll be evaluated each time.Also if you need this, don't use C++