Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

unfused_rvalue_args

Description

An n-ary Polymorphic Function Object adapter template for an unary Polymorphic Function Object target function. When called, its arguments are bundled to a Random Access Sequence of references that is passed to the target function object. All referenced objects in the sequence are const qualified.

The overload set of the adapter's function call operator can be restricted by removing the type member from the nested result metafunction of the Polymorphic Function Object (in this case the substitution-failure-is-not-an-error principle applies for non-nullary calls and nullary calls are explicitly disabled by the library).

[Caution] Caution

As the nullary call operator cannot be a template it will be instantiated along with the class template, so it must be disabled (as described above) in cases where it isn't instantiable.

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 if the target function object is const - or, in case the target function object is held by value, the adapter is const).

Header
#include <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
Synopsis
template <class Function>
class unfused_rvalue_args;
Template parameters
Parameter Description Default
Function A unary Polymorphic Function Object  
Model of

Notation

F
A possibly const qualified, unary Polymorphic Function Object type or reference type thereof
f
An object convertible to F
UR
The type unfused_rvalue_args<F>
ur
An instance of UR, initialized with f
a0...aN
Arguments to ur
Expression Semantics
Expression Semantics
UR(f) Creates a fused function as described above, initializes the target function with f.
UR() Creates a fused function as described above, attempts to use F's default constructor.
ur(a0...aN) Calls f with a Sequence that contains references to the arguments a0...aN.
Example
struct sequence_printer
{
    template <class Seq> 
    struct result 
    { 
        typedef void type;
    };

    template <class Seq>
    void operator()(Seq const & s) const
    {
        std::cout << s << std::endl;
    }
};

void try_it()
{
    unfused_rvalue_args<sequence_printer> print;
    print(24,"bottles of beer in",'a',"box.");
}
See also
Copyright © 2001-2005 Joel de Guzman, Dan Marsden

PrevUpHomeNext