![]() |
Home | Libraries | People | FAQ | More |
Creates a unfused_generic
adapter for
a given, unary Polymorphic
Function Object. The usual element
conversion is applied to the target function.
template <typename F>
inline typename make_unfused_generic
<F>::type
make_unfused_generic(F const & f);
Parameter |
Requirement |
Description |
---|---|---|
|
Model of Polymorphic Function Object |
The function to transform. |
make_unfused_generic(f);
Return type: A specialization of unfused_generic
.
Semantics: Returns a unfused_generic
adapter for
f
.
#include <boost/fusion/functional/generation/make_unfused_generic.hpp> #include <boost/fusion/include/make_unfused_generic.hpp>
struct bottles_song { typedef void result_type; template<class Seq> void operator()(Seq & s) const { typename result_of::at_c<Seq,0>::type n = at_c<0>(s); typename result_of::at_c<Seq,1>::type what = at_c<1>(s); std::cout << n << " bottles of " << what << " on the wall.\n" << n << " bottles of " << what << "!\n" << "Take one down - pass it around.\n"; n -= 1; // glug glug... std::cout << n << " bottles of " << what << " on the wall.\n" << std::endl; } }; void try_it() { unsigned n_milk = 99; for(int i = 0; i < 3; ++i) make_unfused_generic(bottles_song())(n_milk,"milk"); // 96 bottles left for me }