Categories: functors, adaptors | Component type: type |
vector<double> angles; vector<double> sines; const double pi = 3.14159265358979323846; ... assert(sines.size() >= angles.size()); transform(angles.begin(), angles.end(), sines.begin(), compose1(negate<double>(), compose1(ptr_fun(sin), bind2nd(multiplies<double>(), pi / 180.))));
Parameter | Description | Default |
---|---|---|
AdaptableUnaryFunction1 | The type of the first operand in the function composition operation. That is, if the composition is written f o g [1], then AdaptableUnaryFunction1 is the type of the function object f. | |
AdaptableUnaryFunction2 | The type of the second operand in the function composition operation. That is, if the composition is written f o g [1], then AdaptableUnaryFunction2 is the type of the function object g. |
unary_function<AdaptableUnaryFunction2::argument_type, AdaptableUnaryFunction1::result_type>
Member | Where defined | Description |
---|---|---|
argument_type | Adaptable Unary Function | The type of the function object's argument: AdaptableUnaryFunction2::argument_type. |
result_type | Adaptable Unary Function | The type of the result: AdaptableUnaryFunction1::result_type |
unary_compose(const AdaptableUnaryFunction1& f, const AdaptableUnaryFunction2& g); |
unary_compose | See below. |
template <class AdaptableUnaryFunction1, class AdaptableUnaryFunction2> unary_compose<AdaptableUnaryFunction1, AdaptableUnaryFunction2> compose1(const AdaptableUnaryFunction1& op1, const AdaptableUnaryFunction2& op2); |
unary_compose | See below. |
Member | Description |
---|---|
unary_compose(const AdaptableUnaryFunction1& f, const AdaptableUnaryFunction2& g); |
The constructor. Constructs a unary_compose object that represents the function object f o g. [1] |
template <class AdaptableUnaryFunction1, class AdaptableUnaryFunction2> unary_compose<AdaptableUnaryFunction1, AdaptableUnaryFunction2> compose1(const AdaptableUnaryFunction1& op1, const AdaptableUnaryFunction2& op2); |
Creates a unary_compose object. If f and g are, respectively, of classes AdaptableUnaryFunction1 and AdaptableUnaryFunction2, then compose1(f, g) is equivalent to unary_compose<AdaptableUnaryFunction1, AdaptableUnaryFunction2>(f, g), but is more convenient. This is a global function, not a member function. |
[1] This operation is called function composition, hence the name unary_compose. It is often represented in mathematics as the operation f o g, where f o g is a function such that (f o g)(x) == f(g(x)). Function composition is a very important concept in algebra. It is also extremely important as a method of building software components out of other components, because it makes it possible to construct arbitrarily complicated function objects out of simple ones.
Contact Us | Site Map | Trademarks | Privacy | Using this site means you accept its Terms of Use |
Copyright © 1993-2006 Silicon Graphics, Inc. All rights reserved. |