Skip to content

Commit f06f897

Browse files
committed
Apply LWG2395 from N4079: "Preconditions: is defined nowhere"
1 parent 9458ef6 commit f06f897

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

memory.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ <h1><code>memory_resource</code> protected virtual member functions</h1>
204204
<cxx-function>
205205
<cxx-signature>virtual void* do_allocate(size_t bytes, size_t alignment) = 0;</cxx-signature>
206206

207-
<cxx-preconditions>alignment shall be a power of two.</cxx-preconditions>
207+
<cxx-requires>alignment shall be a power of two.</cxx-requires>
208208
<cxx-returns>A derived class shall implement this function to return a pointer to allocated storage (<cxx-ref in="cxx" to="basic.stc.dynamic.deallocation"></cxx-ref>) with a size of at least <code>bytes</code>.
209209
The returned storage is aligned to the specified alignment, if such alignment is supported;
210210
otherwise it is aligned to <code>max_align</code>.</cxx-returns>
@@ -213,8 +213,8 @@ <h1><code>memory_resource</code> protected virtual member functions</h1>
213213

214214
<cxx-function>
215215
<cxx-signature>virtual void do_deallocate(void* p, size_t bytes, size_t alignment) = 0;</cxx-signature>
216-
<cxx-preconditions><code>p</code> shall have been returned from a prior call to <code>allocate(bytes, alignment)</code> on a memory resource equal to <code>*this</code>,
217-
and the storage at <code>p</code> shall not yet have been deallocated.</cxx-preconditions>
216+
<cxx-requires><code>p</code> shall have been returned from a prior call to <code>allocate(bytes, alignment)</code> on a memory resource equal to <code>*this</code>,
217+
and the storage at <code>p</code> shall not yet have been deallocated.</cxx-requires>
218218
<cxx-effects>A derived class shall implement this function to dispose of allocated storage.</cxx-effects>
219219
<cxx-throws>Nothing.</cxx-throws>
220220
</cxx-function>
@@ -316,7 +316,7 @@ <h1><code>polymorphic_allocator</code> constructors</h1>
316316
<cxx-function>
317317
<cxx-signature>polymorphic_allocator(memory_resource* r);</cxx-signature>
318318

319-
<cxx-preconditions><code>r</code> is non-null.</cxx-preconditions>
319+
<cxx-requires><code>r</code> is non-null.</cxx-requires>
320320
<cxx-effects>Sets <code>m_resource</code> to <code>r</code>.</cxx-effects>
321321
<cxx-throws>nothing</cxx-throws>
322322
<cxx-notes>This constructor provides an implicit conversion from <code>memory_resource*</code>.</cxx-notes>
@@ -339,7 +339,7 @@ <h1><code>polymorphic_allocator</code> member functions</h1>
339339

340340
<cxx-function>
341341
<cxx-signature>void deallocate(Tp* p, size_t n);</cxx-signature>
342-
<cxx-preconditions><code>p</code> was allocated from a memory resource, <code>x</code>, equal to <code>*m_resource</code>, using <code>x.allocate(n * sizeof(Tp), alignof(Tp))</code>.</cxx-preconditions>
342+
<cxx-requires><code>p</code> was allocated from a memory resource, <code>x</code>, equal to <code>*m_resource</code>, using <code>x.allocate(n * sizeof(Tp), alignof(Tp))</code>.</cxx-requires>
343343
<cxx-effects>Equivalent to <code>m_resource->deallocate(p, n * sizeof(Tp), alignof(Tp))</code>.</cxx-effects>
344344
<cxx-throws>Nothing.</cxx-throws>
345345
</cxx-function>
@@ -731,7 +731,7 @@ <h1>pool resource constructors and destructors</h1>
731731
<cxx-signature>synchronized_pool_resource(const pool_options& opts, memory_resource* upstream);</cxx-signature>
732732
<cxx-signature>unsynchronized_pool_resource(const pool_options& opts, memory_resource* upstream);</cxx-signature>
733733

734-
<cxx-preconditions><code>upstream</code> is the address of a valid memory resource.</cxx-preconditions>
734+
<cxx-requires><code>upstream</code> is the address of a valid memory resource.</cxx-requires>
735735
<cxx-effects>
736736
Constructs a pool resource object that will obtain memory from <code>upstream</code> whenever the pool resource is unable to satisfy a memory request from its own internal data structures.
737737
The resulting object will hold a copy of <code>upstream</code>, but will not own the resource to which <code>upstream</code> points.
@@ -881,8 +881,8 @@ <h1><code>monotonic_buffer_resource</code> constructor and destructor</h1>
881881
<cxx-signature>explicit monotonic_buffer_resource(memory_resource* upstream);</cxx-signature>
882882
<cxx-signature>monotonic_buffer_resource(size_t initial_size, memory_resource* upstream);</cxx-signature>
883883

884-
<cxx-preconditions><code>upstream</code> shall be the address of a valid memory resource.
885-
<code>initial_size</code>, if specified, shall be greater than zero.</cxx-preconditions>
884+
<cxx-requires><code>upstream</code> shall be the address of a valid memory resource.
885+
<code>initial_size</code>, if specified, shall be greater than zero.</cxx-requires>
886886
<cxx-effects>Sets <code>upstream_rsrc</code> to <code>upstream</code> and <code>current_buffer</code> to <code>nullptr</code>.
887887
If <code>initial_size</code> is specified, sets <code>next_buffer_size</code> to at least <code>initial_size</code>;
888888
otherwise sets <code>next_buffer_size</code> to an implementation-defined size.</cxx-effects>
@@ -891,8 +891,8 @@ <h1><code>monotonic_buffer_resource</code> constructor and destructor</h1>
891891
<cxx-function>
892892
<cxx-signature>monotonic_buffer_resource(void* buffer, size_t buffer_size, memory_resource* upstream);</cxx-signature>
893893

894-
<cxx-preconditions><code>upstream</code> shall be the address of a valid memory resource.
895-
<code>buffer_size</code> shall be no larger than the number of bytes in <code>buffer</code>.</cxx-preconditions>
894+
<cxx-requires><code>upstream</code> shall be the address of a valid memory resource.
895+
<code>buffer_size</code> shall be no larger than the number of bytes in <code>buffer</code>.</cxx-requires>
896896
<cxx-effects>Sets <code>upstream_rsrc</code> to <code>upstream</code>, <code>current_buffer</code> to <code>buffer</code>, and <code>next_buffer_size</code> to <code>initial_size</code> (but not less than 1),
897897
then increases <code>next_buffer_size</code> by an implementation-defined growth factor (which need not be integral).</cxx-effects>
898898
</cxx-function>

mods.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ <h1>Additions to <code>std::function</code></h1>
402402

403403
<cxx-function>
404404
<cxx-signature>void swap(function& other)<del> noexcept</del>;</cxx-signature>
405-
<ins><cxx-preconditions><code>this->get_memory_resource() == other->get_memory_resource()</code>.</cxx-preconditions></ins>
405+
<ins><cxx-requires><code>this->get_memory_resource() == other->get_memory_resource()</code>.</cxx-requires></ins>
406406
<cxx-effects>Interchanges the targets of *this and other.</cxx-effects>
407407
</cxx-function>
408408
</cxx-section>

0 commit comments

Comments
 (0)