Kim Kuen Tang wrote:
From my opinion i 'll say that there is no ready-to-use function in boost.
Hmm! Further digging turned up boost::fusion::invoke(). The following short program builds and runs as expected using Boost 1.39.0 with gcc 4.0.1. The Fusion documentation says that support for boost::array is entirely implemented with the non-intrusive Fusion extension mechanism. Hopefully it won't be too hard to adapt the boost::array extension for our own container. (I'm a bit surprised not to find existing support for std::vector; presumably that's been done a few times by individuals.) #include <iostream> #include <boost/array.hpp> #include <boost/fusion/include/array.hpp> #include <boost/fusion/functional/invocation/invoke.hpp> int somefunc(const std::string& a, const std::string& b) { std::cout << "somefunc('" << a << "', '" << b << "')\n"; return 17; } int main(int argc, char *argv[]) { boost::array<std::string, 2> args = {{"first", "second"}}; int result = boost::fusion::invoke(somefunc, args); std::cout << "somefunc() returned " << result << '\n'; return 0; }