View Template Library

match_element<Container_a, Container_b, Const_tag_a, Base_a, FindType_a, KeyDataPair_a, KeyDataPair_b>

Category: functors

Component type: type

Description

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.

Example

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());

Definition

Defined in functors.hpp.

Template parameters

Parameter

Description

Default

container_a

The view's container A type: the type of container referenced by this view


container_b

The view's container B type: the type of container referenced by this view


const_tag_a

The view's const tag: either const_view_tag or mutable_view_tag

const_view_tag

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

Model of

Adaptable Predicate, DefaultConstructible

Type requirements

Public base classes

Unary_function<container_b::value_type,bool>.

Members

Member

Where defined

Description

argument_type

Adaptable Predicate

The type of the first argument: container_b::value_type

result_type

Adaptable Predicate

The type of the result: bool

match_element()

DefaultConstructible

The default constructor.

match_element(const container_a &)

match_element

The constructor.

bool operator()(const T& x)

Unary Function

Function call operator. The return value is x != 0.

New members

All of match_element's members are defined in the Adaptable Predicate and DefaultConstructible requirements. match_element does not introduce any new members.

Notes

See also

The function object overview, Adaptable Predicate



VTL Home
Copyright © 1999 Konrad-Zuse-Zentrum für Informationstechnik Berlin & Gary Powell All Rights Reserved.