|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-10-31 22:53:27
Hi Bill,
You're not missing anything. The Barton&Nackmann trick used by the operators
library can only provide concrete non-templated operators (dependent on the
template parameters of the derived template), not generalized operators
which would have to be supplied by a templated operator, e.g.:
template <class L, class R>
decimal<(L>R?L:R)> operator+(decimal<L> const&, decimal<R> const&)
{
// whatever...
}
HTH,
Dave
===================================================
David Abrahams, C++ library designer for hire
resume: http://users.rcn.com/abrahams/resume.html
C++ Booster (http://www.boost.org)
email: david.abrahams_at_[hidden]
===================================================
----- Original Message -----
From: "Bill Seymour" <bill-at-the-office_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, October 31, 2001 11:23 AM
Subject: [boost] Using operators.hpp
> Last weekend in Redmond, Beman told me that one objection
> to the fixed-point decimal library was that I hadn't used
> operators.hpp. I said that I had looked at it once and
> my first impression was that it offered more pain than
> gain; but I promised to look at it again.
>
> OK, I'm trying to apply this to the decimal<> class;
> and so far I've written:
>
> template<int Precision = 0>
> class decimal
> : unit_steppable< decimal<Precision>
> , arithmetic2< decimal<Precision>, int
> , arithmetic2< decimal<Precision>, decimal<?>
> , arithmetic2< decimal<Precision>, rounding_proxy< decimal<?> >
> > > > >
>
> Note the two occurrances of decimal<?>. I don't understand
> how to say "decimal<some other precision>" here. What am I
> missing?
>
> Thanks,
>
> --Bill Seymour
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk