How can I avoid “for” loops with an “if” condition inside them with C++?

前端 未结 13 1705
滥情空心
滥情空心 2021-01-30 03:31

With almost all code I write, I am often dealing with set reduction problems on collections that ultimately end up with naive \"if\" conditions inside of them. Here\'s a simple

13条回答
  •  爱一瞬间的悲伤
    2021-01-30 04:23

    I'll just mention Mike Acton, he would definitely say:

    If you have to do that, you have a problem with your data. Sort your data!

提交回复
热议问题