188

you are viewing a single comment's thread
view the rest of the comments
[-] mkwt@lemmy.world 12 points 1 day ago

If anyone is starting to learn C++, make sure to use books or training materials based on C++11 or later.

[-] glibg10b@lemmy.zip 8 points 1 day ago

Even C++11 is pretty old. I would recommend at least C++17

[-] boonhet@sopuli.xyz 5 points 1 day ago

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?

[-] glibg10b@lemmy.zip 10 points 1 day ago

A few examples:

  • CTAD: Instead of std::pair<int, int> 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*
[-] victorz@lemmy.world 5 points 1 day ago

Class Template Argument Deduction (CTAD)

For anyone wondering, like I did.

this post was submitted on 02 Nov 2026
188 points (97.5% liked)

Programmer Humor

33973 readers
192 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS