Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   overloading non-template member functions with template member functions (http://www.velocityreviews.com/forums/t681141-overloading-non-template-member-functions-with-template-member-functions.html)

Hicham Mouline 04-23-2009 11:42 AM

overloading non-template member functions with template member functions
 
Hello,

I have this code
http://codepad.org/CDOFhSqZ

I have a non templated member function GetSpot(tType) const
and a templated one.

Besides, argument 2 and 3 of the templated have default arguments.

Users of this class call either

class.GetSpot( 10. );

or

class.GetSpot<Linear, Polynomial>( 15. ); // case 2

or

class.GetSpot<Linear, Linear>( 15., Linear(5), Linear(7) );

These actual calls happen in 1 translation unit and so the member functions
are instantiated.

Question 1 : Is this valid C++03?
Question 2 : I would like opinions about the style
Question 3 : with vs2005 debugger, arg2 and arg3 in case 2 are not
constructed properly sometimes.

Question 4: would removing the non templated member, and setting default
template args for Interp and Extrap
be possible with at the same time having default formal args 2 and 3.
Would this then be a better style?

PS: typename boost::call_traits<Interp>::param_type is simply
const Interp&
in this case

regards,




All times are GMT. The time now is 10:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.