
Module: Standard C++ Library Library: General utilities
Does not inherit
A binary function object that returns true if both of its arguments are true
#include <functional>
namespace std {
template <class T>
struct logical_and;
}
logical_and is a binary function object. Its operator() returns true if both x and y are true. You can pass a logical_and object to any algorithm that requires a binary function. For example, the transform() algorithm applies a binary operation to corresponding values in two collections and stores the result of the function. logical_and is used in that algorithm in the following manner:
list<bool> list1;
list<bool> list2;
list<bool> listResult;
.
.
.
transform(list1.begin(), vec1.end(),
list2.begin(),
listResult.begin(), logical_and<bool>());
After this call to transform(), listResult(n) contains a 1 (true) if both list1(n) and list2(n) are true, or a 0 (false) if either list1(n) or list2(n) is false.
namespace std {
template <class T>
struct logical_and : binary_function<T, T, bool> {
bool operator() (const T&, const T&) const;
};
}
binary_function, Function Objects
ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 20.3.4
Copyright (c) 1994-2006 Rogue Wave Software, a Quovadx Division.
Licensed under the Apache License, Version 2.0.
Contact Rogue Wave about documentation or support issues. You can also seek help from other developers through the Apache stdcxx community (see below).