In a previous article, I discussed the common programming attributes used in C++ to communicate with the compiler and express intent, such as [[maybe_unused]]
and [[fallthrough]]
. This article will cover a few more attributes that were introduced in C++20.
Below are the new/updated attributes introduced by the C++20 standard:
[[no_unique_address]]
: Indicates that a non-static data member doesn’t need a distinct address from all other non-static data members of its class.[[likely]]
/[[unlikely]]
: Indicates that the compiler should…