default argument and call trait const_reference
Hello,
I have the following template
template<typename C>
class X
{
public:
template ( 5 );
when I debug this P's ctor is never called and mOrder is never 2
Is my GetSpot method valid, the construction of the temporary should be
bound to the const ref
const P&
and the temporary should have finished being constructed before we go inside
the Get() method.
Is there an issue with the definition of Get being out of classe?
Am I calling call_traits<P>::const_reference in a wrong way?
VS2005SP1
Regards,
AMDG Hicham Mouline wrote:
template<typename C> class X { public:
template
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
( 5 );
GetSpot? I only see Get. In Christ, Steven Watanabe
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Steven Watanabe Sent: 09 April 2009 15:40 To: boost-users@lists.boost.org Subject: Re: [Boost-users] default argument and call trait const_reference
AMDG
Hicham Mouline wrote:
template<typename C> class X { public:
template
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
( 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
( 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
participants (2)
-
Hicham Mouline
-
Steven Watanabe