2 ms·
There is a legitimate complaint with that specific example, though: having to write .begin() and .end() is obnoxious instead of using more modern iterators/rang
by pcwalton 11y ago
There is a legitimate complaint with that specific example, though: having to write .begin() and .end() is obnoxious instead of using more modern iterators/ranges.
- nly 11y agowell the slightly more concise way of writing it is this: auto e = end(container); if (e == std::find(begin(container), e, element)) { ... } ...but yeah, it sucks. If I were doing this though, i'd to be encapsulating things in to a higher level abstraction. Seeing std::find in more than 1 place in a file is a red light for me.