
Hi, I want to use the arithmetic operators from boost/operators.hpp but found something strange. If one takes for example boost::rational which uses boost::addable (and others), it is possible to write the following: boost::rational<int> x, y, z; x + y = z; This is not possible for integral types. Is this intended, considered minor or just overseen? Wouldn't it be better for the arithmetic operators to return const T instead of T? Thank you in advance, Thomas

beckmann.bremen@t-online.de (Thomas Beckmann) writes:
Hi,
I want to use the arithmetic operators from boost/operators.hpp but found something strange.
If one takes for example boost::rational which uses boost::addable (and others), it is possible to write the following:
boost::rational<int> x, y, z;
x + y = z;
This is not possible for integral types.
Is this intended, considered minor or just overseen? Wouldn't it be better for the arithmetic operators to return const T instead of T?
It's considered minor and is intentional. Rationale: http://aspn.activestate.com/ASPN/Mail/Message/boost/1394406 -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (2)
-
beckmann.bremen@t-online.de
-
David Abrahams