std::nontyp...d::nontype_t(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ std::nontype, std::nontype_t ✨

okay so this is the C++ Standard Libary manual page, section 3, for std::nontype and std::nontype_t β€” typo in the header and all, she’s still iconic πŸ’…. This whole thing is a C++26 moment, bestie, so hydrate and get comfy 🫢.

πŸ“› NAME πŸ“›

std::nontype,std::nontype_t β€” std::nontype,std::nontype_t. That’s it. That’s the name section. She said what she said πŸŽ€.

πŸ“š Synopsis πŸ“š

Defined in header <utility>. The code is giving template realness, so here it is exactly:

template< auto V >                                    (1) (since C++26)
struct nontype_t { explicit nontype_t() = default; };
template< auto V >                                    (2) (since C++26)
inline constexpr std::nontype_t<V> nontype {};
  1. The class template std::nontype_t can be used in the constructor's parameter list to match the intended tag. Yes, that’s the whole job β€” tag matching, no cap ✨.
  2. The corresponding std::nontype instance of (1) is a disambiguation argument tag that can be passed to the constructors of std::function_ref to indicate that the contained object should be constructed with the value of the non-type template parameter V. It’s giving β€œhello, construct me like this” energy 🫢.

🧩 Template parameters 🧩

  • V β€” non-type template parameter of a structural type. Structural type, bestie, that’s the vibe check πŸ’œ.

πŸ‘€ See also πŸ‘€

  • function_ref β€” non-owning reference to any callable object with specified function call signature (C++26) (class template). Obsessed, honestly.

mwah πŸ’‹ source/version is http://cppreference.com, dated 2024.06.10. That’s the whole page β€” go slay some C++26, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from