Title
basic_string_view::const_iterator should be literal types
Status
resolved
Section
[string.view.template]
Submitter
Antony Polukhin

Created on 2017-03-01.00:00:00 last changed 70 months ago

Messages

Date: 2018-06-12.02:06:47

Proposed resolution:

This wording is relative to N4640.

  1. Add to the end of the [string.view.template] section:

    -1- In every specialization basic_string_view<charT, traits>, the type traits shall satisfy the character traits requirements (21.2), and the type traits::char_type shall name the same type as charT.

    -?- All operations on iterator and const_iterator that are required to satisfy the random access iterator requirements are usable in constant expressions.

Date: 2018-06-12.02:06:47

[ 2018-06 Rapperswil Wednesday issues processing ]

This was resolved by P0858, which was adopted in Jacksonville.

Date: 2017-11-13.19:00:40

[ 2017-11 Albuquerque Saturday issues processing ]

P0858R0 (adopted on Sat; to be moved in Jacksonville) will resolve this.

Date: 2017-03-15.00:00:00

[ 2017-03-04, Kona ]

Set priority to 2. Lisa and Alisdair to work with Antony to come up with better wording. The same wording can be used for 2897.

Date: 2017-03-15.00:00:00

[ 2017-03-02, Tim Song comments ]

I don't believe the blanket "all operations" wording is quite correct.

First, T t; (required by DefaultConstructible) isn't usable in a constant expression if the iterator is a pointer, since it would leave it uninitialized.

Second, an explicit destructor call u.~T() (required by Destructible) isn't usable if the iterator is a class type because it explicitly invokes a non-constexpr function (the destructor); see [expr.const]/2.2.

Date: 2017-03-15.00:00:00

[ 2017-03-02, Kona ]

Wording tweaks suggested by LWG applied.

Date: 2017-03-01.00:00:00

Force the literal type requirement for the const_iterator in the std::basic_string_view so that iterators of std::basic_string_view could be used in constexpr functions.

History
Date User Action Args
2018-06-12 02:06:47adminsetmessages: + msg9903
2018-06-12 02:06:47adminsetstatus: new -> resolved
2017-11-13 19:00:40adminsetmessages: + msg9554
2017-03-14 03:14:09adminsetmessages: + msg9118
2017-03-02 18:49:03adminsetmessages: + msg9041
2017-03-02 17:41:20adminsetmessages: + msg9039
2017-03-01 17:33:58adminsetmessages: + msg9023
2017-03-01 00:00:00admincreate