Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-11-12 23:15:43


On Sunday, November 12, 2000 9:55 PM, Howard Hinnant wrote:

> I don't have imaginary.hpp nor sgn_mag.hpp in front of me, but my
> best guess is that we're dealing with a member template
> conversion operator. Unfortunately 5.3 will not call these
> methods implicitly. They can however be called explicitly. This
> problem has been fixed in Pro 6.
>
> -Howard
>
> On Sunday, November 12, 2000, at 10:23 PM, Daryle Walker wrote:
> > For some reason, my cross-version constructors or conversion
> operators don't
> > work. They gave errors when I tried to compile and use them in my test
> > code. These examples are from my classes in "more_math.zip" in
> the Boost
> > vault.
> >
> > >From "sgn_mag.hpp"
> > // Why doesn't this work?!
> > //#ifndef BOOST_NO_MEMBER_TEMPLATES
> > // template <typename U>
> > // sgn_mag( const sgn_mag<U>& other )
> > // : mag_( other.magnitude() ), sgn_( other.negative() )
> > // {}
> > //#endif // BOOST_NO_MEMBER_TEMPLATES
> >
> > >From "imaginary.hpp"
> > //#ifdef BOOST_NO_MEMBER_TEMPLATES
> > operator std::complex<T>() const
> > { return std::complex<T>( j_ - j_, j_ ); }
> > //#else
> > // Why is this giving syntax errors
> > // template <typename U = T>
> > // operator std::complex<U>() const
> > // { return std::complex<U>( j_ - j_, j_ ); }
> > //#endif // BOOST_NO_MEMBER_TEMPLATES
> >
> > I'm using Metrowerks CodeWarrior Pro 5 with the 5.3 update for
> the (regular)
> > Mac OS. Is my code screwed-up or is the compiler missing something?
> >

Besides the compiler's problem, there is an issue with the code itself -
default template arguments are not allowed for function templates (but in
this case they are unnecessary anyway :).

--Aleksey


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