Boost logo

Boost :

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


Zitat von Steven Watanabe <watanabesj_at_[hidden]>:
> 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()();
>> };
>>
> 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>);
> };

I could, but the functor is a visitor that is provided by the user of
this class, while the call of the operator is an implementation
detail. so I'd rather use a compiler bug workaround for the call than
complicate the visitor interface.
operator(): because it's a functor. you could use call() or apply()
instead of course, but you could for any functor. you just don't
because operator() is the convention.

I've already defined BOOST_OPERATOR_TEMPLATE in my code, but other
compilers might have the same problem, or MSVC might fix this bug, so
I'd rather use a Boost.Config macro if it exists. does it?


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