from Hacker News

C++26: more constexpr in the standard library

by npalli on 5/1/25, 6:36 PM with 62 comments

  • by WalterBright on 5/2/25, 12:36 AM

    D does compile time function evaluation every time there's a ConstExpression in the grammar. It did this back in 2007. It required no changes to the grammar or syntax, it just enhanced constant folding to be able to do function calls.

    I don't understand why it is so complex in C++.

  • by WalterGR on 5/1/25, 9:17 PM

  • by nokeya on 5/1/25, 8:31 PM

    And in the wild (supported by all major compilers) we will see this somewhere around 2040…
  • by gitroom on 5/2/25, 12:18 AM

    love seeing all the constant updates but sometimes i feel like the biggest pain points just stick around way too long - you ever feel like these standards chase the wrong problems sometimes?
  • by kubav027 on 5/1/25, 9:55 PM

    One of my first tasks in my carrier was implementing stable sort to incomplete stl implementation. In 3 years no one used it. This so niche it should not be part of C++ standard.
  • by brooke2k on 5/1/25, 8:36 PM

    seeing the words "constexpr sorting" makes all the compile-time sirens go off in my head
  • by dvratil on 5/1/25, 9:19 PM

    Amazing, now could I just get a way to do asynchronous network requests in two lines of code, like I have with other languages?

    Honestly, it seems to me like the committee is constantly chasing the easy bits but is failing to address the bigger issues in the language and, more importantly, the standard library.