Created on 2017-03-27.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4659.
Change [iterator.synopsis] as indicated:
// [iterator.primitives], primitives template<class Iterator> struct iterator_traits; template<class T> struct iterator_traits<T*>;template<class T> struct iterator_traits<const T*>;
Change [iterator.traits] as indicated:
-3- It is specialized for pointers as
namespace std { template<class T> struct iterator_traits<T*> { using difference_type = ptrdiff_t; using value_type = remove_cv_t<T>; using pointer = T*; using reference = T&; using iterator_category = random_access_iterator_tag; }; }
and for pointers to const asnamespace std { template<class T> struct iterator_traits<const T*> { using difference_type = ptrdiff_t; using value_type = T; using pointer = const T*; using reference = const T&; using iterator_category = random_access_iterator_tag; }; }
[ 2017-07 Toronto Wed Issue Prioritization ]
Priority 0; move to Ready
[ 2017-03-30, David Krauss comments ]
volatile pointers may not be well-behaved random-access iterators. When simple access incurs side effects, the multiple-pass guarantee depends on underlying (hardware) semantics.
iterator_traits accepts pointer to volatile T*, but then says that the value_type is volatile T, instead of T, which is inconsistent for what it does for pointer to const T. We should either reject volatile outright or give the right answer.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2017-11-13 19:01:36 | admin | set | status: voting -> wp |
2017-10-17 18:34:55 | admin | set | status: ready -> voting |
2017-07-15 22:58:07 | admin | set | messages: + msg9380 |
2017-07-15 22:58:07 | admin | set | status: new -> ready |
2017-04-22 17:27:21 | admin | set | messages: + msg9158 |
2017-04-22 17:27:21 | admin | set | messages: + msg9157 |
2017-03-27 00:00:00 | admin | create |