C++ devs (yes, all three of you):
Which features of "modern" C++, that is C++11 and newer, are most valuable to you?
Note: I'm planning a presentation on "modern" C++ features for an audience of programmers generally familiar with C++ as "c with classes", and I'm looking for some fresh perspectives.
@plexus They're really nice though when you need a small, pure function to pass to, e.g., and standard library template or similar, and using them to make closures (with care and when appropriate) is nice.
I've used them to eliminate global state by replacing a static function which referenced a global with a lambda that closes over a local instead, and carries the value down the stack.
@XOR This particular group has had "prefer RAII and stack-based objects to manual memory management" as standard operating procedure for a while, though adherence is not always perfect.
It seems like both C and Java programmers coming to C++ want to new/delete everything. And when asked why, the answer is often, "Oh, I thought you had to in C++."
Don't forget `this` to capture the enclosing object as a capture list option. 😁
@emdeesee I also enjoy irritating coworkers with the alternative operators like "and" instead of "&&".
I think those came in with C++98, though.
(I sometimes use the "not" operator non-ironically, because I like using tiny fonts where ! is easy to miss when you're skimming code.)
@emdeesee I did some searching before answering this question and I found some useful and not so useful items that were unfamiliar.
std::iota is in the "less useful" category (fill a range with x, ++x, ++(++x), etc)
std::minmax and std::minmax_iter look useful. So do the initializer_list versions of min and max, for when you want to min/max more than 2 items.
of course you have standard unordered containers now.
move and emplace and the "&&" type qualifier will cross more than a few eyes.