std::sorted...orted_unique(3)

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

πŸ’– NAME πŸ’–

std::sorted_unique_t, std::sorted_unique β€” std::sorted_unique_t, std::sorted_unique, bestie. This is the std::sorted...orted_unique(3) page from the C++ Standard Libary, and it's literally the tag squad for flat containers. No cap πŸ’….


✨ Synopsis ✨

Defined in header <flat_map>

Defined in header <flat_set>

struct sorted_unique_t { explicit sorted_unique_t() = default; };

(1) β€” since C++23

inline constexpr sorted_unique_t sorted_unique{};

(2) β€” since C++23

  1. The type std::sorted_unique_t can be used in the function's (including constructor's) parameter list to match the intended tag. Yes bestie, constructors get the tag treatment too 🫢.
  2. The corresponding std::sorted_unique instance of (1) is a disambiguation tag that can be passed to the functions of std::flat_map and std::flat_set to indicate that the input range or container is sorted (with respect to the comparator used in flat container adaptor) and all elements of such container or range are unique. Iconic behavior, honestly 🌸.

🌈 Standard library 🌈

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

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

πŸ‘€ See also πŸ‘€

  • sorted_equivalent, sorted_equivalent_t β€” indicates that elements of a range are sorted (uniqueness is not required) (C++23) (tag) πŸ¦‹
  • from_range_t, from_range β€” from-range construction tag (C++23) (tag) πŸŽ€
  • in_place, in_place_type, in_place_index, in_place_t, in_place_type_t, in_place_index_t β€” in-place construction tag (C++17) (tag) πŸ’œ

mwah πŸ’‹ β€” source/version: http://cppreference.com, date: 2024.06.10, page: std::sorted...orted_unique(3). bye bestie, go be iconic with your sorted-unique tags 🫢✨

πŸ“¦ where this page comes from