From 6a73de759698e82f9f2882a4f4fe97ee49ccf33a Mon Sep 17 00:00:00 2001 From: Robert Leahy Date: Mon, 13 Feb 2023 22:09:56 -0500 Subject: [PATCH] P2679R2 Fixing std::start_lifetime_as and std::start_lifetime_as_array Fixes NB CA 086, US 088 (C++23 CD). --- source/memory.tex | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/source/memory.tex b/source/memory.tex index a794e49089..c4def2c41a 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -881,7 +881,8 @@ \begin{itemdescr} \pnum \mandates -\tcode{T} is an implicit-lifetime type\iref{basic.types.general}. +\tcode{T} is an implicit-lifetime type\iref{basic.types.general} +and not an incomplete type\iref{term.incomplete.type}. \pnum \expects @@ -930,15 +931,34 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\mandates +\tcode{T} is a complete type. + \pnum \expects -\tcode{n > 0} is \tcode{true}. +\tcode{p} is suitably aligned for an array of \tcode{T} or is null. +\tcode{n <= size_t(-1) / sizeof(T)} is \tcode{true}. +If \tcode{n > 0} is \tcode{true}, +\range{(char*)p}{(char*)p + (n * sizeof(T))} denotes +a region of allocated storage that is +a subset of the region of storage +reachable through\iref{basic.compound} \tcode{p}. \pnum \effects -Equivalent to: -\tcode{return *start_lifetime_as(p);} +If \tcode{n > 0} is \tcode{true}, +equivalent to +\tcode{start_lifetime_as(p)} where \tcode{U} is the type ``array of \tcode{n} \tcode{T}''. +Otherwise, there are no effects. + +\pnum +\returns +A pointer to the first element of the created array, +if any; +otherwise, +a pointer that compares equal to \tcode{p}\iref{expr.eq}. \end{itemdescr} \rSec2[allocator.tag]{Allocator argument tag}