Boost logo

Boost Users :

Subject: Re: [Boost-users] default argument and call trait const_reference
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-04-09 11:00:26


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Steven Watanabe
> Sent: 09 April 2009 15:40
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] default argument and call trait const_reference
>
> AMDG
>
> Hicham Mouline wrote:
> > template<typename C>
> > class X
> > {
> > public:
> >
> > template<typename Interp, typename Extrap>
> > void Get (int,
> > typename boost::call_traits<Interp>::const_reference=
> > Interp(),
> > typename boost::call_traits<Extrap>::const_reference=
> > Extrap() ) const;
> > };
> >
> > <snip>
> >
> > class P {
> > public:
> > static const size_t defaultInterpolationOrder = 2; // quadratic
> > polynomial
> >
> > Polynomial1D(size_t order =defaultInterpolationOrder)
> > : mOrder(order)
> > {}
> >
>
> This is not legal. The name of the constructor should be
> the same as the name of the class.
>
> > Private:
> >
>
> Should be private? How this code even compiles is beyond me.
>
> > size_t mOrder;
> > };
> >
> > 1 example of call is
> >
> > x.template GetSpot<P,P>( 5 );
> >
>
> GetSpot? I only see Get.

I apologize, I didn't replace all names to make code more readable...
It was just P ... that was P's ctor...

It's Get, not GetSpot
x.template Get<P,P>( 5 );

I've added to default argument to the out-of-class definition as well
and then it works...

does it make any sense?

H


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