Boost logo

Boost :

From: Richard Peters (r.a.peters_at_[hidden])
Date: 2004-05-01 05:15:34


From: "Jody Hagins" <jody-boost-011304_at_[hidden]>
>
> > Unimplemented C++ feature
> > big_integer.hpp line 153
> >
> > The portion in question is
> >
> > template<class T>
> > friend bool operator<(T lhs, const expression<Base>& rhs)
> > { return rhs > lhs; }
> >
> > which doesn't strike me as all that odd, but maybe I'm missing
> > something.
> > I'll try to look at it more, later and see if I can fix the
> > problem.
>
>
> Maybe something as simple as moving the definition...
>
>
> template<class T>
> friend bool operator<(T lhs, const expression<Base>& rhs);
>
> ...
>
> template<class T>
> bool operator<(T lhs, const expression<Base>& rhs)
> {
> return rhs > lhs;
> }

After trying a few things, completely removing the template friend
declaration and defining the function outside of the class seems to work.
I'll implement the changes and upload the code as soon as possible.
vc7.1 does not like template friends to be defined outside the class. The
problem is that it is not a member, but there are two template parameters.
Two seperate lists of template parameters are not allowed, but vc7.1 chokes
when the two parameters are declared in one list (template<class Base>
template<class T> versus template<class Base, class T>) which seems kind of
logical because the two templates are declared seperately in the class. Is
there a correct way to have templated friends of a template class defined
outside of the class?

best regards,

Richard Peters


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