S
shuisheng
Dear All,
Would you please help me to look at this simple case:
Assume I have a function to calculate the power of base ^ order. Here
base can be of any proper type, and order of type size_t.
//! Power with order > 0.
/*!
\param[in] base base.
*/
template<class Type, size_t order>
inline Type Power(Type base)
{
return base * Power<Type, order-1>(base);
}
//! Power with order = 0.
/*!
\param[in] base base.
*/
template<class Type, 0>
inline Type Power<Type, 0>(Type base)
{
return 1;
}
I got some compiler error for the second function Power<Type, 0> to
particularize the Power function.
Thanks for your help!
Shuisheng
Would you please help me to look at this simple case:
Assume I have a function to calculate the power of base ^ order. Here
base can be of any proper type, and order of type size_t.
//! Power with order > 0.
/*!
\param[in] base base.
*/
template<class Type, size_t order>
inline Type Power(Type base)
{
return base * Power<Type, order-1>(base);
}
//! Power with order = 0.
/*!
\param[in] base base.
*/
template<class Type, 0>
inline Type Power<Type, 0>(Type base)
{
return 1;
}
I got some compiler error for the second function Power<Type, 0> to
particularize the Power function.
Thanks for your help!
Shuisheng