...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
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 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 |
---|---|---|
|
|
Notation
R
A possibly const qualified Polymorphic Function Object type or reference type thereof
r
An object convertible to R
s
A Sequence of arguments that
are accepted by r
f
An instance of fused<R>
Expression |
Semantics |
---|---|
|
Creates a fused function as described above, initializes the
target function with |
|
Creates a fused function as described above, attempts to use
|
|
Calls |
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 Sig> struct result; template <class Self, typename T> struct result< Self(T,T) > { typedef typename remove_reference<T>::type 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())); }