Elektrine lite

← Feed

@boonhet@sopuli.xyz

2026-11-02 14:55 UTC

As someone who last touched any C++ books when C++11 was very new and has only written like 20-30 lines of non-tutorial C++ since then, what are some significant changes to the language that I should be aware of if I wanted to give it a try now?

Replies (2)

  • Modules

    Open ##5468260

  • @glibg10b@lemmy.zip 2026-11-02 15:29

    A few examples: CTAD: Instead of std::pair myPair{ 1, 2 }, you just write std::pair myPair{ 1, 2 } std::optional, std::variant and std::any Guaranteed copy elision in some cases, making it more feasible to apply the rule of 5 everywhere Attributes like [[nodiscard]] (compiler warning if an object or return value is discarded) and [[fallthrough]] (suppress a switch fallthrough warning) Generic lambdas ([](auto it){ /* do something */ }) std::string_view, which is much safer as a function parameter than const char*

    Open ##5468297