Boost logo

Boost :

Subject: [boost] [config] explicit call of operator templates / msvc bug workaround
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-05-29 13:38:08


Hi,

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.)

thanks,

Stefan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk