
AMDG Stefan Strasser wrote:
is there already a macro in Boost.Config that allows you to insert the "template" keyword in the following code for those compilers that require it?
struct functor{ template<class T> void operator()(); };
template<class F> void g(F f){ f.template operator()<int>(); //(1) works with GCC and comeau f.operator()<int>(); //(2) works with MSVC }
this apparently only applies to operator calls. MSVC accepts both (1) and (2) for regular functions.
(instantiating the operator template with an object of type T as argument, like mpl::for_each does, is not an option. I can't construct T.)
Why do you want to define this as operator(), when you can't use it as an operator? Can you deal with this the same way you would for for_each? template<class T> struct wrap {}; struct functor { template<class T> void operator()(wrap<T>); }; In Christ, Steven Watanabe