Category: functors |
Component type: type |
match_element<> is a function object. Specifically, it is an Adaptable Predicate, which means it is a function object that tests the truth or falsehood of some condition. If f is an object of class match_element<> and x is an member of container_b, then f(x) returns true if x is in container_a and false otherwise.
Finds the first element in list L that is also in list M.
list<int> L,M; ... list<int>::iterator first_match = find_if(L.begin(), L.end(),match_element<list<int>,list<int> >(M)); assert(first_match == L.end());
Defined in functors.hpp.
Parameter |
Description |
Default |
---|---|---|
container_a |
The view's container A type: the type of container referenced by this view |
|
|
The view's container B type: the type of container referenced by this view |
|
|
The view's const tag: either |
|
base_a |
The view's ownership type: the base class that determines if the view references or owns the container |
referenced_ownership |
FindType_a |
A tag to indicate whether the container's has a member function find, or whether the std::find will be used. InternalFindElement, NoInternalFindElement or PairInternalEqualRange. |
ContainerTrait<container_a>::FindType |
KeyDataPair_a |
A tag to indicate whether the container's value type is a pair. KeyDataPair or NoKeyDataPair |
ContainerTrait<container_a>::ValuePairType |
KeyDataPair_b |
A tag to indicate whether the container's value type is a pair. KeyDataPair or NoKeyDataPair |
ContainerTrait<container_b>::ValuePairType |
Adaptable Predicate, DefaultConstructible
Unary_function<container_b::value_type,bool>.
Member |
Where defined |
Description |
---|---|---|
argument_type |
The type of the first argument: container_b::value_type |
|
result_type |
The type of the result: bool |
|
match_element() |
The default constructor. |
|
match_element(const container_a &) |
match_element |
The constructor. |
bool operator()(const T& x) |
Function call operator. The return value is x != 0. |
All of match_element's members are defined in the Adaptable Predicate and DefaultConstructible requirements. match_element does not introduce any new members.
The function object overview, Adaptable Predicate
VTL Home
Copyright
© 1999 Konrad-Zuse-Zentrum für Informationstechnik Berlin & Gary Powell All Rights Reserved.