
24 Oct
2008
24 Oct
'08
3:36 p.m.
Jeff Flinn wrote:
What would be useful is a generic function object whose argument is the tuple from above and can forward to a supplied function whose arguments are the individual values from the tuple.
Something that keeps me from littering my code with custom functions ala:
void existing_function(const T1&, const T2&, const T3&);
struct tuple_adaptation_of_existing_function { void operator()(const tuple<T1, T2, T3>& t) const { existing_function(get<0>(t), get<1>(t), get<2>(t)); } };
Yep. Boost.Fusion has several such utilities ... http://www.boost.org/doc/libs/1_36_0/libs/fusion/doc/html/fusion/functional/... -- Eric Niebler BoostPro Computing http://www.boostpro.com