
Boost : 
From: Daryle Walker (darylew_at_[hidden])
Date: 20010520 09:29:07
This class template is from the Special Function library under review.
This is what I did to make the quaternion test run:
1. My compiler, CodeWarrior Pro 5.3/Mac, must have a problem with
namespaces and explicit template instantiation. Your code in
"quaternion_test.cpp":
template class ::boost::quaternion<int>;
wouldn't be accepted. It gave errors at the first "::", then at the "boost"
when I removed the "::". I worked around the problem by doing:
// explicit (if ludicrous) instanciation
using boost::quaternion;
template class quaternion<int>;
The template's name must be completely unqualified. I have something of
this form in my CRC test file, but didn't notice the error because my test
template was already local to the file. By the way, I don't think MS VC++
can take any kind of explicit template instantiation.
2. In my comments about sinc_pi and sinhc_pi, I said I commented out the
second versions of those function templates because my compiler couldn't
accept them. I have to make up that difference here by making custom
versions in "quaternion.hpp":
//=========================================================================
namespace boost
{
//...
// Specializations of the indexpi cardinal sine and hyperbolic sine
template<typename T>
inline quaternion<T> sinc_pi(const quaternion<T> x)
{
using ::std::abs;
using ::std::sin;
using ::std::numeric_limits;
if (abs(x) <= numeric_limits<T>::epsilon())
{
return(static_cast< quaternion<T> >(1));
}
else
{
return(sin(x)/x);
}
}
template<typename T>
inline quaternion<T> sinhc_pi(const quaternion<T> x)
{
using ::std::abs;
using ::std::sinh;
using ::std::numeric_limits;
if (abs(x) <= numeric_limits<T>::epsilon())
{
return(static_cast< quaternion<T> >(1));
}
else
{
return(sinh(x)/x);
}
}
} // boost
//=========================================================================
3. The I/O functions had a bunch of errors. The problem was your headers.
The <iosfwd> header is OK if you only need the name of an item, like for a
pointer or a declaration. If you need an item for a definition, like the
implementation of your I/O operators, you need the item's full declaration.
I commented out the <iosfwd> #include and added #includes for <istream>,
<ostream>, and <sstream> in "quaternion.hpp".
 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