Re: "default template arguments may not be used in function templates"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 04, 2005 at 11:52:15AM -0700, Travis Spencer wrote:
> On 7/4/05, Vincent Torri <Vincent.Torri@xxxxxxxxxxxxxxx> wrote:
> > 
> > Hello,
> 
> Hey, Vincent.
> 
> > I have the following class:
> > 
> > template <typename T, typename Synchronizer = synchronizer::None, typename
> > Creator = T * (*)()>
> > class value_cache
> > {
> >   ***
> > 
> > public:  //interface
> > 
> >   boost::shared_ptr<T> Get() const
> >   {
> >     Synchronizer synchronizer();
> > 
> >     ***
> >     ***
> >   }
> > };
> > 
> > But gcc reports this error message at compile time:
> > 
> > "default template arguments may not be used in function templates"
> > 
> > for the declaration of synchronizer().
> > 
> > I use gcc 3.3.4
>

Hi,

your example looks a bit strange to me:

"synchronizer" could either be a class or a namespace;
then in the member function Get of class value_cache
you redeclare synchonizer as a function (with no
arguments, and return type Synchronizer).
Is this really what you want?!
 
> You can't use the default arguments in the function declaration (see
> http://tinyurl.com/bvnbx).

But in the above example there is no *function* template?

Oliver


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux