Title
Replace SIZE_MAX with numeric_limits<size_t>::max()
Status
c++20
Section
[mem.poly.allocator.mem]
Submitter
Japan

Created on 2019-11-04.00:00:00 last changed 45 months ago

Messages

Date: 2019-11-07.08:20:25

Proposed resolution:

This wording is relative to N4835.

  1. Modify [mem.poly.allocator.mem] as indicated:

    [[nodiscard]] Tp* allocate(size_t n);
    

    -1- Effects: If SIZE_MAXnumeric_limits<size_t>::max() / sizeof(Tp) < n, throws length_error. […]

    […]
    template<class T>
      T* allocate_object(size_t n = 1);
    

    -8- Effects: Allocates memory suitable for holding an array of n objects of type T, as follows:

    1. (8.1) — if SIZE_MAXnumeric_limits<size_t>::max() / sizeof(T) < n, throws length_error,

    2. (8.2) — otherwise equivalent to:

      return static_cast<T*>(allocate_bytes(n*sizeof(T), alignof(T)));
      

Date: 2019-11-07.08:20:25

[ 2019-11 Status to Ready during Tuesday morning issue processing in Belfast. ]

Date: 2019-11-04.00:00:00

Addresses JP 218/219

It's better to use a C++ property than C standard library macro, SIZE_MAX.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: voting -> wp
2020-01-17 04:54:50adminsetstatus: ready -> voting
2019-11-07 08:20:25adminsetmessages: + msg10783
2019-11-07 08:20:25adminsetstatus: new -> ready
2019-11-04 18:41:45adminsetmessages: + msg10733
2019-11-04 00:00:00admincreate