From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-03-22 10:16:37
Daniel Frey wrote:
> > What about operations on different types - Duration + Date
> = Date, etc?
> I tried to merge Alexsey's code with some older code of mine. A first
> version shows that you can combine them, but there are some problems
> with the granularity (I mean, to specify which of the 'friends' should
> be used. The code I have is this:
Cool, I thought in the same direction! I don't think that granularity is
really a problem, because, strictly speaking, these using declaration are
unnecessary if you make the operators in the base template 'public'; if you
try to use an operator that does not have an assignment counterpart in the
derived class, you'll get a compile error anyway. The only reason I went
with 'protected' and 'using' declarations is because you _need_ 'using' for
postfix increment and decrement (otherwise, they would be hidden by infix
versions in the derived class), and I felt that consistent use of 'using'
can be easy to remember and also has some nice documentation qualities.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk