std::experi...nstructible(3)

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

πŸ’… std::experimental::ranges::MoveConstructible

okay so bestie, welcome to the <span>... jk, it's just std::experimental::ranges::MoveConstructible, page 3 of the C++ Standard Libary man pages πŸŽ€ (yes that's how the libary spells it, don't come for me πŸ’€). Sit down, grab a strawberry drink πŸ“, and let's get into it.


✨ NAME ✨

std::experimental::ranges::MoveConstructible β€” literally the exact same thing again, <pink>std::experimental::ranges::MoveConstructible</pink> πŸ’– (name so nice they said it twice, iconic behavior tbh πŸ‘‘)


🌸 Synopsis 🌸

First things first, this whole vibe lives in the header:

#include <experimental/ranges/concepts>

and it's shaped like this:

template< class T >
concept bool MoveConstructible =                  (ranges TS)
    Constructible<T, T> && ConvertibleTo<T, T>;

No cap, the concept MoveConstructible is satisfied if T is a reference type, or if it's an object type where an object of that type can be constructed from an rvalue of that type β€” in both direct-initialization and copy-initialization contexts β€” with the usual semantics 🫢.

πŸ¦‹ more precisely, bestie πŸ¦‹

If T is an object type, then MoveConstructible<T> is satisfied only if given:

  • rv, an rvalue of type T, and
  • u2, a distinct object of type T equal to rv,

the following are true, periodt:

  • After the definition T u = rv;, u is equal to u2;
  • T{rv} is equal to u2; and
  • If T is not const-qualified, then rv's resulting state (after the definition/expression is evaluated in either bullets above) is valid but unspecified; otherwise, it is unchanged.
⚠️ not me flagging the "valid but unspecified" part: that's a real vibe check from the standard, it doesn't promise you anything specific about rv afterward πŸ’€ it's legal, it's just not telling you what's in there. And if T is const-qualified? Then it's unchanged, full stop πŸ™ˆ

πŸ’… See also πŸ’…

  • is_move_constructible β€” (C++11), class template ✨
  • is_trivially_move_constructible β€” checks if a type can be constructed from an rvalue reference, (C++11), class template 🌈
  • is_nothrow_move_constructible β€” (C++11), class template πŸ’œ

(iykyk β€” all three are the C++11 class-template girlies in the same club πŸŽ€)


that's the whole page bestie, no crumbs left πŸ“βœ¨ this little icon was served up from http://cppreference.com, dated 2024.06.10, and its footer reads std::experi...nstructible(3) β€” slay, go move-construct something responsibly πŸ’…πŸ‘‘

πŸ“¦ where this page comes from