Say you have a tuple and want to generate a new tuple by applying a metafunction on each type of the first one. What’ the most efficient C++ metafuntion to accomplish to this task? Is it also possible to use C++0x variadic template to provide a better implementation?
Share
How ’bout this one:
Then
That’s using a metafunction class by wrapping the
applyinto a non-template. That allows passing it to C++03 templates (which cannot accept templates with arbitrary parameters by simply doingtemplate<typename...> class X). You may, of course, accept a pure metafunction (not a class) tooAnd use the
std::add_pointertemplateOr you can wrap it into a class so it is compatible with the first version
Hope it helps.