3 ms·
New Features in C++26
- deleted 2y ago[deleted]
- pjmlp 2y agoI love how the comments section quickly goes into "better fast benchmark winning code with surprising unexpected side effects" than "working code that is fast enough".
- otabdeveloper4 2y agoWhy? If you're the kind of guy who thinks his code is "fast enough" (pro tip, it actually isn't) you're already coding in Javascript, not C++.
- pjmlp 2y agoPro tip, learn to use a profiler.
- otabdeveloper4 2y agoI did, it said the Javascript interpreter is slow. Check and mate.
- bun_terminator 2y agoAnd this is just the "small stuff". C++26 might land reflections, std::execution and contracts in one go - which would make this mighty
- 8474_s 2y agoThe Template pack index is going to make meta-template variadics much easier. Usually this is prone to cludges like converting parameters to structs or filtering them with functions holding the pack.
- munch117 2y agoReading the example: template <typename... T> constexpr auto first_plus_last(T... values) -> T...[0] { return T...[0](values...[0] + values...[sizeof...(values)-1]); } it seems there are 5 different kinds of uses of "...". 1. typename... 2. sizeof... 3. values... 4. T... representing multiple parameters in the formal parameter list. 5. T... for the type of the pack (supporting T...[0], the new feature). I don't have a big point, I'm just mildly amused. Even with the simplifying new syntax, it took me a while to work through what is what in the example. I wonder why it's T...[0] and not just T[0]? In parameter lists you need the distinction between "T", a single parameter of pack type, and "T...", multiple parameters supplied from the pack. But I don't see a similar need in an expression.
- gpderetta 2y agoI think for types you could do without the dots in T...[0], but it mirrors the usage for values (values...[0] is different from (values[0]...). So consistency I guess.
- signa11 2y agoto me at least, hazard pointers and rcu seems to be the major changes, for library authors anyways. i would actually wager that rcu in and of itself is almost at par with atomics and the memory-model :o) for folks wondering about 'hazard-pointers' this paper https://web.archive.org/web/20171104135736/http://www.research.ibm.com/people/m/michael/ieeetpds-2004.pdf https://web.archive.org/web/20171104135736/http://www.resear... is quite useful as an excellent starting point.
- masjl 2y ago[flagged]