.\" ident @(#)negate.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH negate 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2negate\fP \ - Unary function object that returns the negation of its argument. .SH SYNOPSIS .br #include .br template .br struct negate : public unary_function; .SH DESCRIPTION negate is a unary function object. Its \f2operator()\fP returns the negation of its argument: \f2true\fP if its argument is \f2false\fP, or \f2false\fP if its argument is \f2true\fP. You can pass a negate object to any algorithm that requires a unary function. For example, the transform algorithm applies a unary operation to the values in a collection and stores the result. negate could be used in that algorithm in the following manner: .br vector vec1; .br vector vecResult; .br . .br . .br . .br transform(vec1.begin(), vec1.end(), vecResult.begin(), .RE .RS 10 negate()); .RE After this call to transform, \f2vecResult(n)\fP contains the negation of the element in \f2vec1(n)\fP. .SH INTERFACE .RE .RS 0 template .br struct negate : unary_function { .RE .RS 1 T operator() (const T&) const; .RE .RS 0 }; .SH WARNINGS If your compiler does not support default template parameters, then you always need to supply the \f2Allocator\fP template argument. For instance, you need 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 Function_Objects, unary_function