|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2002-03-12 14:57:56
Aren't these the same as boost.operators incrementable, decrementable, addable,
and subtractable?
Jeff
> -----Original Message-----
> From: Dan Gohman [mailto:gohmandj_at_[hidden]]
> Sent: Tuesday, March 12, 2002 12:09 PM
> To: boost_at_[hidden]
> Subject: [boost] operators.hpp suggestions
>
>
> Here are some suggestions for operators.hpp based on some classes
> that I've found to be useful. I haven't come up with good names for
> them, though.
>
> // increasable?
> friend T& operator++(T& x) { return x += 1; }
>
> // decreasable?
> friend T& operator--(T& x) { return x -= 1; }
>
> friend T& operator-=(T& x, U const& y)
> { return x += -y; }
>
> friend bool operator<(T const& x, U const& y)
> { return x - y < 0; }
>
> // I haven't actually used these for anything.
> friend T operator-(T const& x) { return 0 - x; }
> friend T operator+(T const& x) { return x; }
>
> Dan
>
> --
> Dan Gohman
> gohmandj_at_[hidden]
>
> Info: http://www.boost.org Send unsubscribe requests to:
> <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