News for hackers. Stuff that matters.
Re:C++17 Standard Published by repsilat on Tuesday December 05, 2017 @10:38PM (#15858265)
> std::set::contains()

I live in a "fast languages only when necessary, and with restraint" shop. Our C++ is not idiomatic, it is meant for programmers from other languages. Anything with iterators is a bit sketchy. It tends to look more like C than C++, and now that I'm an old person I am perfectly happy with that.

We use `s.count(i) == 1`. It's ok -- clear, readable etc. Doesn't give you an iterator if you want to delete the thing too, but most of the time you don't.

Re:C++17 Standard Published by tbrock on Tuesday December 05, 2017 @11:23PM (#15858479)
Oooph, I'm no expert but that is not "good" C++ style. Definitely prefer using the iterator methods.
Re:C++17 Standard Published by 0xBA5ED on Tuesday December 05, 2017 @11:33PM (#15858535)
If it effectively solves your particular problems in your specific situation, then it IS good style ;)
Re:C++17 Standard Published by tbrock on Wednesday December 06, 2017 @11:02AM (#15862098)
This depends on knowing the intervals of that type and expecting them to not change.

Just trying to help. This code is entirely implementation specific.