3 ms·
Having the compiler deduce the return type of a function depending on the constexpr path taken is really useful.
by secondcoming 3y ago
Having the compiler deduce the return type of a function depending on the constexpr path taken is really useful.
- AlotOfReading 3y agoDifferent feature, I'm talking about the optional initialization section added to conditionals. It allows moving declarations to the point of use like for statements. I've also met people who think it's now the appropriate place to declare all block scope variables, which is horrifying.
- cmrdporcupine 3y agoIt's horrifying but maybe also intriguing? Has shades of the OCaml/StandardML "let ... " scope: StandardML: let val a = 1 val b = 2 in a + b end It's nice for making it clear that the scope of the assignment is restricted to this lexical scope, though there are other ways to do this in C/C++. I work in Rust these days so haven't had a chance to use much of this, but I wonder if this has some nice RAII type use patterns? I may now go explore.