Title
Placeholders should be allowed and encouraged to be constexpr
Status
c++17
Section
[func.bind.place]
Submitter
Stephan T. Lavavej

Created on 2015-03-27.00:00:00 last changed 89 months ago

Messages

Date: 2015-05-22.19:14:31

Proposed resolution:

This wording is relative to N4296.

  1. Change [function.objects] p2 "Header <functional> synopsis" as depicted:

    namespace placeholders {
      // M is the implementation-defined number of placeholders
      see belowextern unspecified _1;
      see belowextern unspecified _2;
      ...
      see belowextern unspecified _M;
    }
    
  2. Change [func.bind.place] p2 as depicted:

    namespace std::placeholders {
      // M is the implementation-defined number of placeholders
      see belowextern unspecified _1;
      see belowextern unspecified _2;
                 .
                 .
                 .
      see belowextern unspecified _M;
    }
    

    -1- All placeholder types shall be DefaultConstructible and CopyConstructible, and their default constructors and copy/move constructors shall not throw exceptions. It is implementation-defined whether placeholder types are CopyAssignable. CopyAssignable placeholders' copy assignment operators shall not throw exceptions.

    -?- Placeholders should be defined as:

    constexpr unspecified _1{};
    

    If they are not, they shall be declared as:

    extern unspecified _1;
    
Date: 2015-05-07.00:00:00

[ 2015-05-07 Lenexa: Move to Immediate ]

STL: I'd like this one immediate.

Jonathan: I want to think about forcing constexpr, but the current issue, I have no objections. I'd say ready, but I won't object to immediate if STL wants it.

Marshall: You should report in Kona how it worked out.

STL: We went around a bit on the reflector about how to phrase the encouragement.

Jonathan: I think the shall may be not quite right.

Marshall: I see, you can change your implementation, but you don't.

Jonathan: There's precedent for the shall, but it's wrong, see editorial issue 493.

STL: I would prefer not to ask Daniel to reword, and 493 can fix it later.

Marshall: I remove my objection to immediate because it doesn't force implementations to change.

Marshall: Any other discussion?

Marshall: Immediate vote: 6. Opposed, 0. Abstain, 1.

Date: 2015-03-27.00:00:00

piecewise_construct ([pair.piecewise]), allocator_arg ([allocator.tag]), and adopt_lock/defer_lock/try_to_lock ([thread.lock]) are all required to be constexpr with internal linkage. bind()'s placeholders should be allowed to follow this modern practice, for increased consistency and reduced implementer headaches (header-only is easier than separately-compiled).

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2015-05-22 19:14:31adminsetmessages: + msg7438
2015-05-22 18:31:21adminsetstatus: immediate -> wp
2015-05-08 22:28:57adminsetstatus: new -> immediate
2015-04-03 16:40:18adminsetmessages: + msg7321
2015-03-27 00:00:00admincreate