![]() |
Home | Libraries | People | FAQ | More |
An unary Polymorphic Function Object adapter template for a Polymorphic Function Object target function. It takes a Forward Sequence that contains the arguments for the target function.
The nested result
metafunction
is inhertied from the target function.
The type of the target function is allowed to be const qualified or a reference.
Const qualification is preserved and propagated appropriately (in other
words, only const versions of operator()
can be used
for an target function object that is const or, if the target function
object is held by value, the adapter is const).
#include <boost/fusion/functional/adapter/fused_function_object.hpp>
template <class Function> class fused_function_object;
Parameter | Description | Default |
---|---|---|
Function |
Polymorphic Function Object type |
Notation
R
r
R
s
r
f
fused<R>
Expression | Semantics |
---|---|
fused_function_object<R>(r) |
Creates a fused function
as described above, initializes the target function with r . |
fused_function_object<R>() |
Creates a fused
function as described above, attempts to use R 's
default constructor. |
f(s) |
Calls
r with the elements
in s as its arguments. |
template<class SeqOfSeqs, class Func> typenameresult_of::transform
< zip_view<SeqOfSeqs> const, fused_function_object<Func const &> >::type n_ary_transform(SeqOfSeqs const & s, Func const & f) { returntransform
(zip_view<SeqOfSeqs>(s), fused_function_object<Func const &>(f)); } struct sub { template<typename T, typename _> struct result { typedef T type; }; template<typename T> T operator()(T lhs, T rhs) const { return lhs - rhs; } }; void try_it() {vector
<int,float> a(2,2.0f);vector
<int,float> b(1,1.5f);vector
<int,float> c(1,0.5f); assert(c == n_ary_transform(vector_tie
(a,b), sub())); }
Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger |