.\" ident @(#)logical_or.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH logical_or 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2logical_or\fP \ - A binary function object that returns \f2true\fP if either of its arguments are \f2true\fP. .SH SYNOPSIS .br #include .br template .br struct logical_or : binary_function ; .SH DESCRIPTION logical_or is a binary function object. Its \f2operator()\fP returns \f2true\fP if either \f2x\fP or \f2y\fP are \f2true\fP. 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: .br vector vec1; .br vector vec2; .br vector vecResult; .br . .br . .br . .br transform(vec1.begin(), vec1.end(), .RE .RS 9 vec2.begin(), .br vecResult.begin(), logical_or()); .RE After this call to transform, \f2vecResult(n)\fP contains a \f21\fP (\f2true\fP) if either \f2vec1(n)\fP or \f2vec2(n)\fP is \f2true\fP or a \f20\fP (\f2false\fP) if both \f2vec1(n)\fP and \f2vec2(n)\fP are \f2false\fP. .SH INTERFACE .RE .RS 0 template .br struct logical_or : binary_function { .RE .RS 1 bool operator() (const T&, const T&) const; .RE .RS 0 }; .SH WARNINGS If your compiler does not support default template parameters, you always need to supply the \f2Allocator\fP template argument. For instance, you have to write: \f2vector >\fP instead of: \f2vector\fP If your compiler does not support namespaces, then you do not need the using declaration for \f2std\fP. .SH SEE ALSO binary_function, Function_Objects