
Module: Standard C++ Library Library: General utilities
Does not inherit
A binary function object that returns true if either of its arguments are true
#include <functional>
namespace std {
template <class T>
struct logical_or;
}
logical_or is a binary function object. Its operator() returns true if either x or y are true. You can pass a logical_or 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_or is used in that algorithm in the following manner:
list<bool> list1;
list<bool> list2;
list<bool> listResult;
.
.
.
transform(list1.begin(), list1.end(),
list2.begin(),
listResult.begin(), logical_or<bool>());
After this call to transform(), listResult(n) contains a 1 (true) if either list1(n) or list2(n) is true, or a 0 (false) if both list1(n) and list2(n) are false.
namespace std {
template <class T>
struct logical_or : 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).