Boost logo

Boost Users :

Subject: Re: [Boost-users] [Enable-if] Selectively instantiating methods.
From: Julien Nitard (julien.nitard_at_[hidden])
Date: 2011-09-23 10:57:24


On Fri, Sep 23, 2011 at 11:48 PM, Igor R <boost.lists_at_[hidden]> wrote:

> > I didn't test, but I think something like this should do the job:
> >
> >> template<typename T> struct S
> >> {
> >> template <class T1 = T>
> >> typename disable_if<is_const<T1>, int>::type mutating_method();
> >> };
>
>
> Default template arguments are disallowed for function templates.
>
>
>

True, but they are allowed in C++0x/11 (and maybe the restriction applies
only to free-standing functions, not methods, didn't have time to dig up
more).

http://stackoverflow.com/questions/2447458/default-template-arguments-for-function-templates

Julien



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net