Title
is_bind_expression should derive from integral_constant<bool>
Status
c++11
Section
[func.bind.isbind]
Submitter
Alisdair Meredith

Created on 2009-03-19.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. In [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;
     };
    }
    
  2. In [func.bind.isbind]/2 change as indicated:

    static const bool value;
    

    -2- true if T is a type returned from bind, false otherwise. If T is a type returned from bind, is_bind_expression<T> shall be publicly derived from integral_constant<bool, true>, otherwise it shall be publicly derived from integral_constant<bool, false>.

  3. In [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;
     };
    }
    
  4. In [func.bind.isplace]/2 change as indicated:

    static const int value;
    

    -2- value is J if T is the type of std::placeholders::_J, 0 otherwise. If T is the type of std::placeholders::_J, is_placeholder<T> shall be publicly derived from integral_constant<int, J> otherwise it shall be publicly derived from integral_constant<int, 0>.

Date: 2010-10-21.18:28:33

[ 2009-10 post-Santa Cruz: ]

Move to Tentatively Ready. We are comfortable with requiring user specializations to derive from integral_constant.

Date: 2009-05-31.00:00:00

[ 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 that is_bind_expression<E> always derives from integral_constant, whereas it may not.

is_bind_expression and is_placeholder allow user specializations, and in fact, this is their primary purpose. Such user specializations may not derive from integral_constant, and the places where is_bind_expression and is_placeholder are used intentionally do not require such derivation.

The long-term approach here is to switch to BindExpression<E> and Placeholder<P> explicit concepts, of course, but until that happens, I say leave them alone.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We recommend this be deferred until after the next Committee Draft is issued.

Move to Open.

Date: 2009-03-22.00:00:00

[ 2009-03-22 Daniel provided wording. ]

Date: 2010-10-21.18:28:33

[ Daniel adds: ]

We need the same thing for the trait is_placeholder as well.

Date: 2009-03-19.00:00:00

Class template is_bind_expression [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.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg587
2010-10-21 18:28:33adminsetmessages: + msg586
2010-10-21 18:28:33adminsetmessages: + msg585
2010-10-21 18:28:33adminsetmessages: + msg584
2010-10-21 18:28:33adminsetmessages: + msg583
2010-10-21 18:28:33adminsetmessages: + msg582
2009-03-19 00:00:00admincreate