[Boost-bugs] [Boost C++ Libraries] #8313: const definition of boost::none

Subject: [Boost-bugs] [Boost C++ Libraries] #8313: const definition of boost::none
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-20 11:32:52


#8313: const definition of boost::none
------------------------------+---------------------------------------------
 Reporter: anonymous | Owner: fcacciola
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: optional
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 boost provides an object named boost::none of type boost::none_t. it
 originally stems from Boost.Optional, but since it is in the root
 directory, boost/none.hpp, I guess it is there for other uses as well.

 I tried to use it in the following way, which fails, because of the
 definition of boost::none:

 template<class T,class T2=boost::none_t>
 struct A{
     A(T &a,T2 &b=none);
 };

 boost::none is an object defined to be const, so it is not accepted as a
 non-const reference. I don't see a reason why it has to be const. its
 value is never used anyway.

 I'll probably have to use boost::enable_if instead, to enable a "unary"
 constructor if and only if T2 == boost::none_t

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8313>
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:12 UTC