Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit c89e626766.
PrevUpHomeNext
make_fused_function_object
Description

Creates a fused_function_object adapter for a given Deferred Callable Object. The usual element conversion is applied to the target function.

Synopsis
template <typename F>
inline typename result_of::make_fused_function_object<F>::type
make_fused_function_object(F const & f);
Parameters

Parameter

Requirement

Description

f

Model of Polymorphic Function Object

The function to transform.

Expression Semantics
make_fused_function_object(f);

Return type: A specialization of fused_function_object.

Semantics: Returns a fused_function_object adapter for f.

Header
#include <boost/fusion/functional/generation/make_fused_function_object.hpp>
#include <boost/fusion/include/make_fused_function_object.hpp>
Example
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 == transform(zip(a,b), make_fused_function_object(sub())));
}
See also

PrevUpHomeNext