std::mergeable(3)

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

🌸 NAME 🌸

std::mergeable β€” std::mergeable. That's it, that's the name bestie πŸ’… (we're hanging out in std::mergeable(3) from the C++ Standard Libary β€” yep, "Libary", that's the header's spelling, no cap).

✨ Synopsis ✨

          Defined in header <iterator>
          template< class I1, class I2, class Out, class Comp = ranges::less,

                    class Proj1 = std::identity, class Proj2 = std::identity >
          concept mergeable =
              std::input_iterator<I1> &&
              std::input_iterator<I2> &&
              std::weakly_incrementable<Out> &&
       (since C++20)
              std::indirectly_copyable<I1, Out> &&
              std::indirectly_copyable<I2, Out> &&
              std::indirect_strict_weak_order<Comp,
                                              std::projected<I1, Proj1>,

                                              std::projected<I2, Proj2>>;

Ok so the mergeable concept specifies the requirements for algorithms that merge two input ranges into a single output range, according to the strict weak ordering imposed by Comp ✨. It's giving "requirements list but make it cute," and honestly? Obsessed.

🧚 Semantic requirements 🧚

mergeable is modeled only if all concepts it subsumes are modeled. Periodt β€” no shortcuts, bestie πŸ’œ.

πŸ”₯ See also πŸ”₯

  • ranges::merge β€” merges two sorted ranges (C++20) (niebloid)
  • ranges::set_union β€” computes the union of two sets (C++20) (niebloid)
  • ranges::set_intersection β€” computes the intersection of two sets (C++20) (niebloid)
  • ranges::set_difference β€” computes the difference between two sets (C++20) (niebloid)
  • ranges::set_symmetric_difference β€” computes the symmetric difference between two sets (C++20) (niebloid)

Sign-off time 🫢: this page came from http://cppreference.com, dated 2024.06.10, and it's std::mergeable(3). Bye bestie, go merge something iconic πŸ’–πŸŽ€

πŸ“¦ where this page comes from