This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
is_bind_expression
should derive from integral_constant<bool>
Section: 22.10.15.2 [func.bind.isbind] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-03-19 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [func.bind.isbind].
View all issues with C++11 status.
Discussion:
Class template is_bind_expression 22.10.15.2 [func.bind.isbind]:
namespace std { template<class T> struct is_bind_expression { static const bool value = see below; }; }
is_bind_expression
should derive from std::integral_constant<bool>
like
other similar trait types.
[ Daniel adds: ]
We need the same thing for the trait
is_placeholder
as well.
[ 2009-03-22 Daniel provided wording. ]
[ Batavia (2009-05): ]
We recommend this be deferred until after the next Committee Draft is issued.
Move to Open.
[ 2009-05-31 Peter adds: ]
I am opposed to the proposed resolution and to the premise of the issue in general. The traits's default definitions should NOT derive from
integral_constant
, because this is harmful, as it misleads people into thinking thatis_bind_expression<E>
always derives fromintegral_constant
, whereas it may not.
is_bind_expression
andis_placeholder
allow user specializations, and in fact, this is their primary purpose. Such user specializations may not derive fromintegral_constant
, and the places whereis_bind_expression
andis_placeholder
are used intentionally do not require such derivation.The long-term approach here is to switch to
BindExpression<E>
andPlaceholder<P>
explicit concepts, of course, but until that happens, I say leave them alone.
[ 2009-10 post-Santa Cruz: ]
Move to Tentatively Ready. We are comfortable with requiring user specializations to derive from
integral_constant
.
Proposed resolution:
In 22.10.15.2 [func.bind.isbind] change as indicated:
namespace std { template<class T> struct is_bind_expression : integral_constant<bool, see below> { };{ static const bool value = see below; };}
In 22.10.15.2 [func.bind.isbind]/2 change as indicated:
static const bool value;-2-
Iftrue
ifT
is a type returned frombind
,false
otherwise.T
is a type returned frombind
,is_bind_expression<T>
shall be publicly derived fromintegral_constant<bool, true>
, otherwise it shall be publicly derived fromintegral_constant<bool, false>
.
In 22.10.15.3 [func.bind.isplace] change as indicated:
namespace std { template<class T> struct is_placeholder : integral_constant<int, see below> { };{ static const int value = see below; };}
In 22.10.15.3 [func.bind.isplace]/2 change as indicated:
static const int value;-2-
value isIfJ
ifT
is the type ofstd::placeholders::_J
, 0 otherwise.T
is the type ofstd::placeholders::_J
,is_placeholder<T>
shall be publicly derived fromintegral_constant<int, J>
otherwise it shall be publicly derived fromintegral_constant<int, 0>
.