I'm using this code to create multiple functions wrappers using variadic templates:
// Compile with g++ -std=c++0x $(pkg-config sigc++-2.0 --cflags --libs) test.cpp -o test
#include <iostream>
#include <type_traits>
#include <sigc++/sigc++.h>
template <typename R, typename G, typename... Ts>
class FuncWrapper
{
public:
FuncWrapper(G object, std::string const& name, sigc::slot<R, Ts...> function) {};
};
int main()
{
FuncWrapper<void, int, int, bool, char> tst(0, "test", [] (int a, bool b, char c) {});
return EXIT_SUCCESS;
}
This code correctly compiles with clang++, but not with g++ due to the known issue:
test.cpp:9:73: sorry, unimplemented: cannot expand ‘Ts ...’ into a fixed-length argument list
I know that gcc-4.7 should handle this correctly, but I can't upgrade for now... So I'd like to have a workaround to make Ts...
to unpack correctly. I've tested what suggested here in questions like this one, but they don't seem to solve the issue here.