Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4462: make_signed is not SFINAE friendly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-22 16:09:09
#4462: make_signed is not SFINAE friendly
---------------------------------+------------------------------------------
Reporter: 1czajnik@⦠| Owner: johnmaddock
Type: Bugs | Status: closed
Milestone: Boost 1.44.0 | Component: type_traits
Version: Boost 1.44.0 | Severity: Problem
Resolution: invalid | Keywords: sfinae
---------------------------------+------------------------------------------
Changes (by johnmaddock):
* status: new => closed
* resolution: => invalid
Comment:
This is not a bug - it's a deliberate design decision - make_signed is
documented to require an integral or enumeration type as an argument (the
latest draft of the std has the same restriction on std::make_signed).
The static_assertion failure you're seeing is just make_signed asserting
it's requirements.
To do what you want, you would have to use boost::enable_if on the return
type so that SFINAE fails if T is not an integer type, or else create your
own thin wrapper about make_signed, something like:
template <class T>
struct make_signed_or_self
{
typedef typename mpl::if_<is_integral<T>, make_signed<T>::type,
T>::type type;
};
All just typed in off the top of my head....
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4462#comment:1> 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:03 UTC