std::indirectly_copyable(3)

πŸ“¦
version 2024.07.05 Β· 3 versions
, in nixpkgs unstable, opensuse-leap 16.0

std::indirectly_copyable(3) πŸ’…βœ¨

okay bestie, welcome to the C++ Standard Libary page for std::indirectly_copyable β€” and yes, the header says β€œLibary,” not β€œLibrary,” so we’re keeping her exactly as she is 🫢. This is a C++20 concept, it’s giving iterator-relationship realness, and we’re gonna read it together like a group chat. No cap.

🌸 NAME 🌸

std::indirectly_copyable β€” literally std::indirectly_copyable. That’s the name, that’s the whole thing, periodt πŸ’–.

✨ Synopsis ✨

          Defined in header <iterator>
          template< class In, class Out >

          concept indirectly_copyable =                                  (since
       C++20)
              std::indirectly_readable<In> &&

              std::indirectly_writable<Out, std::iter_reference_t<In>>;

The page literally says (since C++20), so you know it’s fresh ✨. And yes, that line break is canon, bestie 😭.

So what’s the concept actually saying? std::indirectly_copyable specifies the relationship between an indirectly_readable type and a type that is indirectly_writable. The indirectly_writable type must be able to directly copy the object that the indirectly_readable type references. That’s the whole flex: readable on one side, writable on the other, and the copy can happen directly. Slay πŸ’….

bestie PSA: the requirements are real β€” both std::indirectly_readable<In> and std::indirectly_writable<Out, std::iter_reference_t<In>> have to hold. πŸ”₯

πŸ‘€ See also πŸ‘€

  • indirectly_movable (C++20) β€” specifies that values may be moved from an indirectly_readable type to an indirectly_writable type (concept). πŸ¦‹
  • indirectly_copyable_storable (C++20) β€” specifies that values may be copied from an indirectly_readable type to an indirectly_writable type and that the copy may be performed via an intermediate object (concept). πŸŽ€

mwah πŸ’‹ source is http://cppreference.com, dated 2024.06.10, and the page is std::indirectly_copyable(3). byeee bestie, go copy something directly πŸ’–βœ¨

πŸ“¦ where this page comes from