
13 Aug
2009
13 Aug
'09
4:17 p.m.
Andrew Sutton wrote:
That seems overly complicated. Why not...
template <typename...> failed call(...); template <typename F, typename... Args> auto call(F&& f, Args... args) -> decltype(f(args...));
Because that's C++0x, while my code is C++03.
I'm waving my hands a bit since F() and Args() require everything to be default constructible, but you can get around that with some clever metaprogramming machinery and fake accessor functions.
Which is why I use make<T>() instead of T().
Caveat: you probably need an SVN build of GCC to actually make that work without internal compiler errors :)
I've had no problem at all with a standard GCC 4.4 build. What kind of ICEs are they? If it's mangling issues, they're not very hard to circumvent usually.