std::experi...tagged_pair(3)

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

hey bestie, welcome to the std::experi...tagged_pair(3) page 🫢 β€” manual name? C++ Standard Libary (yes, that's the spelling, leave it alone πŸ’…). It's giving C++ standard library template energy, and we're gonna get you comfy with it.


🌸 NAME 🌸

std::experimental::ranges::tagged_pair β€” the short description is literally std::experimental::ranges::tagged_pair again. Self-titled icon behavior, no cap. πŸ‘‘


✨ Synopsis ✨

okay so this thing is defined in header <experimental/ranges/utility>.

Here's the exact synopsis, bestie:

template< TaggedType T1, TaggedType T2 >         (ranges TS)
using tagged_pair = /* see below */;

It's a convenience alias template for naming a ranges::tagged wrapping a std::pair ✨.

A TaggedType is a function type S(T), where S is a TagSpecifier and T is the type of the element. Keep that in your notes fr fr.

So:

tagged_pair<S1(T1), S2(T2)>

is an alias for:

ranges::tagged<std::pair<T1, T2>, S1, S2>

slay, that's the whole alias situation. πŸ’–


πŸ’– Notes πŸ’–

⚠️ caveat time, bestie β€” read this before you get too comfy.

Because a function type is used to "glue" the tag specifier and the corresponding element type together, the usual parameter type adjustments apply. In particular, top-level cv-qualifiers are removed and array types are adjusted to pointers:

tagged_pair<tag::in(const int* const), tag::out(int[])>

is:

ranges::tagged<std::pair<const int*, int*>, tag::in, tag::out>

so yeah, the function-type glue has consequences. Not me warning you about type adjustments πŸ’€.


πŸ‘€ See also πŸ‘€

okay here's the friend group / linked-reference section 🫢:

  • TaggedType β€” specifies that a type represents a tag specifier and its element type (concept).
  • tagged β€” augument a tuple-like type with named accessors (class template). (yes, "augument" is what the page says, I'm not fixing their spelling πŸ™ˆ)
  • make_tagged_pair β€” convenience function for creating a tagged_pair (function template).
  • tagged_tuple β€” alias template for a tagged std::tuple (alias template).
  • make_tagged_tuple β€” convenience function for creating a tagged_tuple (function template).
  • in, in1, in2, out, out1, out2, fun, min, max, begin, end β€” tag specifiers for use with ranges::tagged (class).

xoxo, super cute sign-off time: source is http://cppreference.com, version/date is 2024.06.10, and the footer title is std::experi...tagged_pair(3). bestie, go forth and tag ur pairs πŸ’…πŸ’–

πŸ“¦ where this page comes from