Document numberP2045R1
Date2020-02-14
ProjectProgramming Language C++, Library Working Group
Reply-toMarshall Clow <mclow.lists@gmail.com>

Missing Mandates for the standard library

Introduction

As the "Mandating the standard library" papers have progressed/been applied, a few bits have been missed; mostly because parts of the library have moved.

This paper fixes those bits.

Thanks to Richard Smith for enumerating these parts.

Thanks to Tim Song for his review of R0.

Changes from R0:

Wording

These changes are based on N4842.

In [tab:cpp17.allocator], change the "Requires" to an "Preconditions":

Preconditions:Requires: (*p).m is well-defined.

Preconditions:Requires: (*q).m is well-defined.

Preconditions:Requires: p isshall be a value returned by an earlier call to allocate that has not been invalidated by an intervening call to deallocate. n matchesshall match the value passed to allocate to obtain this memory.

   

In [coroutine.handle.con]/2, change the "Requires" to an "Preconditions":

Preconditions:Requires: p is a reference to a promise object of a coroutine.

   

In [coroutine.handle.export.import]/2, change the "Requires" to an "Preconditions":

Preconditions:Requires: addr was obtained via a prior call to address

   

In [coroutine.handle.observers]/2, change the "Requires" to an "Preconditions":

Preconditions:Requires: *this refers to a suspended coroutine

   

In [coroutine.handle.resumption], edit /2, /3 /4, as follows:

Preconditions:Requires: *this refers to a suspended coroutine. The coroutine is not suspended at its final suspend point.

Effects: Resumes the execution of the coroutine. If the coroutine was suspended at its final suspend point, behavior is undefined.

Preconditions:Requires: *this refers to a suspended coroutine

   

In [coroutine.handle.promise]/1, change the "Requires" to an "Preconditions":

Preconditions:Requires: *this refers to a coroutine.

   

In [util.smartptr.atomic.shared]/3, /6, and /12, change the "Requires" to an "Preconditions":

Preconditions:Requires: order is neither The order argument shall not be memory_order::consume, memory_order::acquire, nor memory_order::acq_rel.

Preconditions:Requires: order is neithershall not be memory_order::release nor memory_order::acq_rel.

Preconditions:Requires: failure is neithershall not be memory_order::release nor memory_order::acq_rel.

   

In [util.smartptr.atomic.weak]/3, /6 and /12, change the "Requires" to an "Preconditions":

Preconditions:Requires: order is neither The order argument shall not be memory_order::consume, memory_order::acquire, nor memory_order::acq_rel.

Preconditions:Requires: order is neithershall not be memory_order::release nor memory_order::acq_rel

Preconditions:Requires: failure is neithershall not be memory_order::release nor memory_order::acq_rel