Category: functors |
Component type: type |
is_nonzero<T> 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 is_nonzero<T> and x is an object of class T, then f(x) returns true if x != 0 and false otherwise.
Finds the first zero element in a list.
list<int> L; ... list<int>::iterator first_nonzero = find_if(L.begin(), L.end(),is_nonzero<int>()); assert(first_nonzero == L.end() || *first_nonzero == 0);
Defined in functors.hpp.
Parameter |
Description |
Default |
---|---|---|
T |
The type of is_nonzero's arguments. |
|
Adaptable Predicate, DefaultConstructible
T is is_nonzeroThan Comparable.
unary_function<T,bool>.
Member |
Where defined |
Description |
---|---|---|
argument_type |
The type of the argument: T |
|
result_type |
The type of the result: bool |
|
is_nonzero() |
The default constructor. |
|
bool operator()(const T& x) |
Function call operator. The return value is x != 0. |
All of is_nonzero's members are defined in the Adaptable Predicate and DefaultConstructible requirements. is_nonzero does not introduce any new members.
VTL Home
Copyright
© 1999, 2000 Konrad-Zuse-Zentrum für Informationstechnik
Berlin & Gary Powell All Rights Reserved.