.\" ident @(#)multiplies.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH multiplies 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2multiplies\fP \ - A binary function object that returns the result of multiplying its first and second arguments. .SH SYNOPSIS .br #include .br template .br struct multiplies : binary_function { .RE .RS 1 T operator() (const T&, const T&) const; .RE .RS 0 }; .SH DESCRIPTION multiplies is a binary function object. Its \f2operator()\fP returns the result of multiplying \f2x\fP and \f2y\fP. You can pass a multiplies object to any algorithm that uses a binary function. For example, the transform algorithm applies a binary operation to corresponding values in two collections and stores the result. multiplies would be 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(),
vec2.begin(), vec2.end(),
vecResult.begin(), multiplies()); After this call to transform, \f2vecResult(n)\fP contains \f2vec1(n)\fP times \f2vec2(n)\fP. .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 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