Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-05-19 07:28:11


These are from the Special Function library currently under review.

First Issue: Template-based Template Parameters

My compiler, CodeWarrior Pro 5.3/Mac, can't handle function templates that
have template-based template parameters at all. I had to comment out the
second versions of both functions to get the code to compile. We would have
to #define BOOST_NO_TEMPLATE_BASED_FUNCTION_TEMPLATE_PARAMETERS in
<boost/config.hpp> to make sure some compilers can survive. With the
various problems with templates that occur with the common compilers, why
depend on the rarest feature, template-based template parameters?

Second Issue: Too General?

These problematic versions are supposed to be shortcuts for defining sinc_pi
and sinhc_pi for complex, quaterions, octonions, and the like. They assume
that any kind of U<T> defines a numeric type with a vector-like algebra of
components T. Some templates violate that, like boost::rational. I know
that's not the kind of type you expect to use with sinc_pi, but another
numeric template may come along that defines a floating type, but doesn't
define a vector algebra. That (hypothetical) class would have to take the
burden of defining custom sinc_pi and sinhc_pi function templates to avoid
being matched with your second sinc_pi and sinhc_pi. It could be better to
avoid that by making your quaterions and octonions take the burden instead
by defining custom sinc_pi and sinhc_pi function templates in their
respective headers. This would have to be the workaround for compilers that
can't handle the problematic versions, anyway. (For std::complex, where you
can't make a custom function template version, maybe use the "functor class
template used by a function template" idiom and specialize std::complex's
version of the functor.)

Third Issue: Testing

There is a minor testing issue, since the problematic versions are not
tested within the Special Function's test file.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk