[Boost-bugs] [Boost C++ Libraries] #2938: [operators] BOOST_OPERATOR2_LEFT prevents builtin types from being used as first template parameter

Subject: [Boost-bugs] [Boost C++ Libraries] #2938: [operators] BOOST_OPERATOR2_LEFT prevents builtin types from being used as first template parameter
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-04-11 16:51:26


#2938: [operators] BOOST_OPERATOR2_LEFT prevents builtin types from being used as
first template parameter
----------------------------------------------+-----------------------------
 Reporter: Arne Mertz <boost_at_[hidden]> | Owner: daniel_frey
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: operators
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
----------------------------------------------+-----------------------------
 Minimal code example:

 #include <boost/operators.hpp>


 class X : public boost::subtractable2_left<double, X>
 {
 public:
   friend double& operator-= (double& lhs, X const&)
   { return lhs; }

   operator double() const {return 1.0;}
 };


 int main()
 {
   X x;
   double d = x - 0.5; //ERROR: left operand of op-= has to be l-value
 }

 #defines BOOST_NO_NRVO and BOOST_FORCE_SYMMETRIC_OPERATORS are not set, so
 the short implementation in line 240 (as of Sat April 4th, 2009) is used:
 return T( lhs ) -= rhs;
 on msvc 2008 express this does not work with T being a builtin type.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2938>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC