Title
Omissions in constexpr usages
Status
cd1
Section
[array][template.bitset]
Submitter
Daniel Krügler

Created on 2007-08-25.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. In the class template definition of [array]/p. 3 change

    constexpr bool empty() const;
    
  2. In the class template definition of [template.bitset]/p. 1 change

    constexpr bool test(size_t pos ) const;
    

    and in [bitset.members] change

    constexpr bool test(size_t pos ) const;
    
Date: 2010-10-21.18:28:33

[ Sophia Antipolis: ]

We handle this as two parts

  1. The proposed resolution is correct; move to ready.
  2. The issue points out a real problem, but the issue is larger than just this solution. We believe a paper is needed, applying the full new features of C++ (including extensible literals) to update std::bitset. We note that we do not consider this new work, and that is should be handled by the Library Working Group.

In order to have a consistent working paper, Alisdair and Daniel produced a new wording for the resolution.

Date: 2007-08-25.00:00:00
  1. The member function bool array<T,N>::empty() const should be a constexpr because this is easily to proof and to implement following it's operational semantics defined by Table 87 (Container requirements) which says: a.size() == 0.
  2. The member function bool bitset<N>::test() const must be a constexpr (otherwise it would violate the specification of constexpr bitset<N>::operator[](size_t) const, because it's return clause delegates to test()).
  3. I wonder how the constructor bitset<N>::bitset(unsigned long) can be declared as a constexpr. Current implementations usually have no such bitset c'tor which would fulfill the requirements of a constexpr c'tor because they have a non-empty c'tor body that typically contains for-loops or memcpy to compute the initialisation. What have I overlooked here?
History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3540
2010-10-21 18:28:33adminsetmessages: + msg3539
2007-08-25 00:00:00admincreate