...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
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. Only LValue arguments are accepted.
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).
/functional/adapter/unfused_lvalue_args.hpp>
template <class Function> class unfused_lvalue_args;
Parameter |
Description |
Default |
---|---|---|
|
A unary Polymorphic Function Object |
|
Notation
F
A possibly const qualified, unary Polymorphic Function Object type or reference type thereof
f
An object convertible to F
UL
The type unfused_lvalue_args<F>
ul
An instance of UL
,
initialized with f
a0
...aN
Arguments to ul
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 |
struct fused_incrementer
{
template <class Seq>
struct result
{
typedef void type;
};
template <class Seq>
void operator()(Seq const & s) const
{
for_each
(s,++boost::lambda::_1);
}
};
void try_it()
{
unfused_lvalue_args<fused_incrementer> increment;
int a = 2; char b = 'X';
increment(a,b);
assert(a == 3 && b == 'Y');
}