std::sorted...d_equivalent(3)

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

πŸŽ€ NAME πŸŽ€

std::sorted_equivalent_t,std::sorted_equivalent β€” std::sorted_equivalent_t,std::sorted_equivalent

Okay bestie, real talk: this page is from the C++ Standard Libary manual (yes, that’s how the header spells it, not me πŸ’…), section 3. It’s all about these two little tag cuties.


✨ Synopsis ✨

Both of these are defined in the headers below, and they’re giving β€œtag disambiguation” main character energy since C++23:

Defined in header <flat_map>
Defined in header <flat_set>

struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };  (1) (since C++23)
inline constexpr sorted_equivalent_t sorted_equivalent{};                  (2) (since C++23)
  1. The type std::sorted_equivalent_t can be used in the function’s (including constructor’s) parameter list to match the intended tag. 🫢
  2. The corresponding std::sorted_equivalent instance of (1) is a disambiguation tag that can be passed to the functions of std::flat_multimap and std::flat_multiset to indicate that the input range or container is sorted (with respect to the comparator used in flat container adaptor), whilst uniqueness of elements is not required. No cap, it literally just says β€œsorted is fine, duplicates are fine too.” 😌

🌈 Standard library 🌈

The following standard library container adaptors use (1,2) as disambiguation tags:

  • flat_multimap β€” adapts two containers to provide a collection of key-value pairs, (C++23) sorted by keys; (class template) πŸ”₯
  • flat_multiset β€” adapts a container to provide a collection of keys, sorted by keys, (C++23); (class template) ✨

πŸ¦‹ See also πŸ¦‹

  • sorted_unique β€” indicates that elements of a range are sorted and unique 🌸
  • sorted_unique_t β€” (tag) (C++23)
  • from_range_t β€” from-range construction tag πŸŽ€
  • from_range β€” (tag) (C++23)
  • in_place, in_place_type, in_place_index β€” in-place construction tag πŸ’–
  • in_place_t, in_place_type_t, in_place_index_t β€” (tag) (C++17)

okay that’s the whole page, mwah πŸ’‹ β€” source/version is http://cppreference.com, dated 2024.06.10, and the footer label is std::sorted...d_equivalent(3). slay. πŸ‘‘

πŸ“¦ where this page comes from