Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/iterator/mergeable"

From cppreference.com
< cpp‎ | iterator
(removes equality preservation since it's not a direct requirement for this concept)
(rename template parameters)
 
(One intermediate revision by one user not shown)
Line 4: Line 4:
 
{{dcl header | iterator}}
 
{{dcl header | iterator}}
 
{{dcl | since=c++20 | 1=
 
{{dcl | since=c++20 | 1=
template< class I1, class I2, class Out, class R = ranges::less,
+
template< class I1, class I2, class Out, class Comp = ranges::less,
           class P1 = std::identity, class P2 = std::identity >
+
           class Proj1 = std::identity, class Proj2 = std::identity >
 
concept mergeable =
 
concept mergeable =
 
     std::input_iterator<I1> &&
 
     std::input_iterator<I1> &&
Line 12: Line 12:
 
     std::indirectly_copyable<I1, Out> &&
 
     std::indirectly_copyable<I1, Out> &&
 
     std::indirectly_copyable<I2, Out> &&
 
     std::indirectly_copyable<I2, Out> &&
     std::indirect_strict_weak_order<R,
+
     std::indirect_strict_weak_order<Comp,
                                     std::projected<I1, P1>,
+
                                     std::projected<I1, Proj1>,
                                     std::projected<I2, P2>>;
+
                                     std::projected<I2, Proj2>>;
 
}}
 
}}
 
{{dcl end}}
 
{{dcl end}}
  
The {{tt|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 {{tt|R}}.
+
The {{tt|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 {{tt|Comp}}.
  
 
===Semantic requirements===
 
===Semantic requirements===
Given types {{tt|I1}} and {{tt|I2}}, {{tt|I1}} and {{tt|I2}} model {{tt|mergeable}} only if all concepts it subsumes are modeled.
+
{{tt|mergeable}} is modeled only if all concepts it subsumes are modeled.
  
 
===See also===
 
===See also===

Latest revision as of 23:05, 2 October 2021

 
 
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
mergeable
(C++20)
(C++20)
Utilities
(C++20)
Iterator adaptors
Range access
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++17)
 
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> &&
    std::indirectly_copyable<I1, Out> &&
    std::indirectly_copyable<I2, Out> &&
    std::indirect_strict_weak_order<Comp,
                                    std::projected<I1, Proj1>,

                                    std::projected<I2, Proj2>>;
(since C++20)

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.

[edit] Semantic requirements

mergeable is modeled only if all concepts it subsumes are modeled.

[edit] See also

merges two sorted ranges
(niebloid)[edit]
computes the union of two sets
(niebloid)[edit]
computes the intersection of two sets
(niebloid)[edit]
computes the difference between two sets
(niebloid)[edit]
computes the symmetric difference between two sets
(niebloid)[edit]