Boost logo

Boost :

Subject: Re: [boost] [config] explicit call of operator templates / msvc bug workaround
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-10-10 12:12:22

On 29/05/2010 19:38, Stefan Strasser wrote:
> 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.)

I know this is old, but I'd really like to see the right macro defect be
added to Boost.Config.

Contrary to other comments of the thread, I think this is a core defect,
and not just a corner case. The use case is also valid, and superior to
the alternatives for a number of reasons.

Boost list run by bdawes at, gregod at, cpdaniel at, john at