Created on 2018-11-29.00:00:00 last changed 13 months ago
Proposed resolution:
This wording is relative to N4820.
Modify [default.allocator] as follows:
-1- All specializations of the default allocator satisfy the allocator completeness requirements ([allocator.requirements.completeness]).
namespace std { template<class T> class allocator { public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; using propagate_on_container_move_assignment = true_type;using is_always_equal = true_type;constexpr allocator() noexcept; constexpr allocator(const allocator&) noexcept; template<class U> constexpr allocator(const allocator<U>&) noexcept; ~allocator(); allocator& operator=(const allocator&) = default; [[nodiscard]] T* allocate(size_t n); void deallocate(T* p, size_t n); }; }-?- allocator_traits<allocator<T>>::is_always_equal::value is true for any T.
Add a new subclause in Annex D after [depr.str.strstreams]:
D.? The default allocator [depr.default.allocator]
-?- The following member is defined in addition to those specified in [default.allocator]:namespace std { template <class T> class allocator { public: using is_always_equal = true_type; }; }
[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]
[ 2020-10-02; Issue processing telecon: Moved to Tentatively Ready. ]
[ 2019-07 Cologne ]
Jonathan provides updated wording.
[ 2019-02 Priority set to 2 after reflector discussion ]
Previous resolution [SUPERSEDED]:This wording is relative to N4778.
Modify [default.allocator] as follows:
-1- All specializations of the default allocator satisfy the allocator completeness requirements ([allocator.requirements.completeness]).
namespace std { template<class T> class allocator { public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; using propagate_on_container_move_assignment = true_type;using is_always_equal = true_type;constexpr allocator() noexcept; constexpr allocator(const allocator&) noexcept; template<class U> constexpr allocator(const allocator<U>&) noexcept; ~allocator(); allocator& operator=(const allocator&) = default; [[nodiscard]] T* allocate(size_t n); void deallocate(T* p, size_t n); }; }-?- allocator_traits<allocator<T>>::is_always_equal::value is true for any T.
I (Billy O'Neal) attempted to change MSVC++'s standard library to avoid instantiating allocators' operator== for allocators that are declared is_always_equal to reduce the number of template instantiations emitted into .objs.
In so doing I introduced an unrelated bug related to POCMA handling, but it brought my attention to this allocator. This allocator doesn't meet the allocator requirements because it is getting std::allocator's operator== and operator!= which don't compare the root member. However, if this had been a conforming C++14 allocator with its own == and != we would still be treating it as is_always_equal, as it picks that up by deriving from std::allocator. std::allocator doesn't actually need is_always_equal because the defaults provided by allocator_traits will say true_type for it, since implementers don't make std::allocator stateful. Billy O'Neal thinks this is NAD on the grounds that we need to be able to add things or change the behavior of standard library types. Stephan T Lavavej thinks we should resolve this anyway because we don't know of an implementation for which this would change the default answer provided by allocator_traits.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 21:40:50 | admin | set | messages: + msg11556 |
2020-11-09 21:40:50 | admin | set | status: ready -> wp |
2020-10-02 17:32:00 | admin | set | messages: + msg11498 |
2020-10-02 17:32:00 | admin | set | status: open -> ready |
2019-07-22 17:12:46 | admin | set | status: new -> open |
2019-07-17 21:27:56 | admin | set | messages: + msg10483 |
2019-02-18 00:16:57 | admin | set | messages: + msg10310 |
2018-12-01 16:18:24 | admin | set | messages: + msg10243 |
2018-11-29 00:00:00 | admin | create |