This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
3310. ReplaceSIZE_MAX
with numeric_limits<size_t>::max()
Section: 20.5.3.3 [mem.poly.allocator.mem] Status: C++20 Submitter: Japan Opened: 2019-11-04 Last modified: 2021-02-25
Priority: 0
View all other issues in [mem.poly.allocator.mem].
View all issues with C++20 status.
Discussion:
Addresses JP 218/219
It's better to use a C++ property than C standard library macro, SIZE_MAX
.
[2019-11 Status to Ready during Tuesday morning issue processing in Belfast.]
Proposed resolution:
This wording is relative to N4835.
Modify 20.5.3.3 [mem.poly.allocator.mem] as indicated:
[[nodiscard]] Tp* allocate(size_t n);[…]-1- Effects: If
SIZE_MAX numeric_limits<size_t>::max() / sizeof(Tp) < n
, throwslength_error
. […]template<class T> T* allocate_object(size_t n = 1);-8- Effects: Allocates memory suitable for holding an array of
n
objects of typeT
, as follows:
(8.1) — if
SIZE_MAX numeric_limits<size_t>::max() / sizeof(T) < n
, throwslength_error
,(8.2) — otherwise equivalent to:
return static_cast<T*>(allocate_bytes(n*sizeof(T), alignof(T)));
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4