Boost logo

Boost :

From: Dan Gohman (gohmandj_at_[hidden])
Date: 2002-03-12 15:08:47


No, they are different.

incrementable and decremental require prefix ++ and -- and supply
their postfix counterparts. addable and subtractable require +=
and -= respectively and provide + and -.

increasable and decreasable below require += and -= and supply
prefix ++ and --, for example.

Dan

On Tue, Mar 12, 2002 at 12:57:56PM -0700, Jeff Garland wrote:
> 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/
> >
> >
>
>
> 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/
>
>

-- 
Dan Gohman
gohmandj_at_[hidden]

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