Created on 2019-10-16.00:00:00 last changed 45 months ago
Proposed resolution:
This wording is relative to N4835.
Modify [mem.poly.allocator.class], class template polymorphic_allocator synopsis, as indicated:
namespace std::pmr {
template<class Tp = byte> class polymorphic_allocator {
[…]
// [mem.poly.allocator.mem], member functions
[[nodiscard]] Tp* allocate(size_t n);
void deallocate(Tp* p, size_t n);
[[nodiscard]] void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t));
void deallocate_bytes(void* p, size_t nbytes, size_t alignment = alignof(max_align_t));
template<class T> [[nodiscard]] T* allocate_object(size_t n = 1);
template<class T> void deallocate_object(T* p, size_t n = 1);
template<class T, class... CtorArgs> [[nodiscard]] T* new_object(CtorArgs&&... ctor_args);
template<class T> void delete_object(T* p);
[…]
};
}
Modify [mem.poly.allocator.mem] as indicated:
[[nodiscard]] void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t));[…]-5- Effects: Equivalent to: return memory_rsrc->allocate(nbytes, alignment);
[…]template<class T> [[nodiscard]] T* allocate_object(size_t n = 1);-8- Effects: Allocates memory suitable for holding an array of n objects of type T, as follows:
[…]
(8.1) — if SIZE_MAX / sizeof(T) < n, throws length_error,
(8.2) — otherwise equivalent to:
return static_cast<T*>(allocate_bytes(n*sizeof(T), alignof(T)));template<class T, class CtorArgs...> [[nodiscard]] T* new_object(CtorArgs&&... ctor_args);-11- Effects: Allocates and constructs an object of type T, as follows. Equivalent to:
[…]T* p = allocate_object<T>(); try { construct(p, std::forward<CtorArgs>(ctor_args)...); } catch (...) { deallocate_object(p); throw; } return p;
[ 2019-11; Friday AM in Belfast. Status changed to "Ready" ]
[ 2019-11-4; Daniel comments ]
This issue is related to LWG 3312.
[ 2019-11 After discussion with LEWG, assigning to LEWG ]
[ 2019-11 Priority to 3 during Monday issue prioritization in Belfast ]
[[nodiscard]] is specified for std::polymorphic_allocator<>::allocate().
But the allocate functions added with P0339R6 doesn't have it. Isn't [[nodiscard]] necessary for these functions?History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2020-02-24 16:02:59 | admin | set | status: voting -> wp |
2020-01-17 04:54:50 | admin | set | status: ready -> voting |
2020-01-07 16:01:55 | admin | set | messages: + msg10921 |
2020-01-07 16:01:55 | admin | set | status: lewg -> ready |
2019-11-04 19:27:52 | admin | set | messages: + msg10739 |
2019-11-04 14:01:07 | admin | set | messages: + msg10730 |
2019-11-04 14:01:07 | admin | set | status: new -> lewg |
2019-11-04 13:23:43 | admin | set | messages: + msg10724 |
2019-10-19 12:06:05 | admin | set | messages: + msg10705 |
2019-10-16 00:00:00 | admin | create |