Przejdź do głównej zawartości

C++ named requirements: BinaryPredicate

BinaryPredicate is a set of requirements expected by some of the standard library facilities from the user-provided arguments.

Given a BinaryPredicate bin_pred and a pair of iterators iter1 and iter2 or an iterator iter and a (possibly const) (od C++20) value value, the expression bin_pred(*iter1, *iter2) or, respectively, bin_pred(*iter, value), must be contextually convertible to bool.

In addition, evaluation of that expression is not allowed to call non-const member functions of the dereferenced iterators; syntactically, the predicate must accept const object arguments, with the same behavior regardless of whether its arguments are const or non-const (od C++20).

Requirements

Standard library

The following standard library facilities expect a BinaryPredicate which isn't a Compare type.

pubunique(C++11)removes consecutive duplicate elements
(public member function of std::forward_list<T,Allocator>)
pubuniqueremoves consecutive duplicate elements
(public member function of std::list<T,Allocator>)
pubfind_endfinds the last sequence of elements in a certain range
pubfind_first_ofsearches for any one of a set of elements
pubadjacent_findfinds the first two adjacent items that are equal (or satisfy a given predicate)
pubmismatchfinds the first position where two ranges differ
pubequaldetermines if two sets of elements are the same
pubis_permutation(C++11)determines if a sequence is a permutation of another sequence
pubsearchsearches for a range of elements
pubsearch_nsearches a range for a number of consecutive copies of an element
pubuniqueremoves consecutive duplicate elements in a range
(function template)
pubunique_copycreates a copy of some range of elements that contains no consecutive duplicates
pubnot2 (wycofane w C++17) (removed in C++20)constructs custom std::binary_negate object
pubunordered_set(C++11)collection of unique keys, hashed by keys
pubunordered_map(C++11)collection of key-value pairs, hashed by keys, keys are unique
pubunordered_multiset(C++11)collection of keys, hashed by keys
pubunordered_multimap(C++11)collection of key-value pairs, hashed by keys

C++ named requirements: BinaryPredicate

BinaryPredicate is a set of requirements expected by some of the standard library facilities from the user-provided arguments.

Given a BinaryPredicate bin_pred and a pair of iterators iter1 and iter2 or an iterator iter and a (possibly const) (od C++20) value value, the expression bin_pred(*iter1, *iter2) or, respectively, bin_pred(*iter, value), must be contextually convertible to bool.

In addition, evaluation of that expression is not allowed to call non-const member functions of the dereferenced iterators; syntactically, the predicate must accept const object arguments, with the same behavior regardless of whether its arguments are const or non-const (od C++20).

Requirements

Standard library

The following standard library facilities expect a BinaryPredicate which isn't a Compare type.

pubunique(C++11)removes consecutive duplicate elements
(public member function of std::forward_list<T,Allocator>)
pubuniqueremoves consecutive duplicate elements
(public member function of std::list<T,Allocator>)
pubfind_endfinds the last sequence of elements in a certain range
pubfind_first_ofsearches for any one of a set of elements
pubadjacent_findfinds the first two adjacent items that are equal (or satisfy a given predicate)
pubmismatchfinds the first position where two ranges differ
pubequaldetermines if two sets of elements are the same
pubis_permutation(C++11)determines if a sequence is a permutation of another sequence
pubsearchsearches for a range of elements
pubsearch_nsearches a range for a number of consecutive copies of an element
pubuniqueremoves consecutive duplicate elements in a range
(function template)
pubunique_copycreates a copy of some range of elements that contains no consecutive duplicates
pubnot2 (wycofane w C++17) (removed in C++20)constructs custom std::binary_negate object
pubunordered_set(C++11)collection of unique keys, hashed by keys
pubunordered_map(C++11)collection of key-value pairs, hashed by keys, keys are unique
pubunordered_multiset(C++11)collection of keys, hashed by keys
pubunordered_multimap(C++11)collection of key-value pairs, hashed by keys