Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2007-04-11 15:11:30


> Matthias Schabel wrote:
>> What do you think about proposing to add mpl::unary_plus,
>> mpl::unary_minus, mpl::pow, and mpl::root to the MPL arithmetic
>> operations?
>
> mpl::negate already exists. There is no point to unary plus. pow
> and root would be good.

Actually, there's nothing preventing someone from defining a unary +
operator that doesn't return the same type as the type it operates
on, to the best of my knowledge, so it is potentially important to
consider that possibility :

struct blah { };
struct blahblah { };

blahblah operator+(const blah&) { return blahblah(); }

 From a notational standpoint, it would be nice to have unary_plus
and unary_minus, although unary_minus would just delegate to negate.

Matthias


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