Skip to content

Commit 1e2f334

Browse files
committed
P2679R2 Fixing std::start_lifetime_as and std::start_lifetime_as_array
Fixes NB CA-086, US-34-088 (C++23 CD).
1 parent 9ce105b commit 1e2f334

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

source/memory.tex

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,8 @@
878878
\begin{itemdescr}
879879
\pnum
880880
\mandates
881-
\tcode{T} is an implicit-lifetime type\iref{basic.types.general}.
881+
\tcode{T} is an implicit-lifetime type\iref{basic.types.general}
882+
and not an incomplete type.
882883

883884
\pnum
884885
\expects
@@ -927,15 +928,33 @@
927928
\end{itemdecl}
928929

929930
\begin{itemdescr}
931+
\pnum
932+
\mandates
933+
\tcode{T} is a complete type.
934+
930935
\pnum
931936
\expects
932-
\tcode{n > 0} is \tcode{true}.
937+
\tcode{p} is suitably aligned for an array of \tcode{T} or is null.
938+
\tcode{n <= size_t(-1) / sizeof(T)} is \tcode{true}.
939+
\range{(char*)p}{(char*)p + (n * sizeof(T))} denotes
940+
a region of allocated storage that is
941+
a subset of the region of storage
942+
reachable through\iref{basic.compound} \tcode{p}.
933943

934944
\pnum
935945
\effects
936-
Equivalent to:
937-
\tcode{return *start_lifetime_as<U>(p);}
946+
If \tcode{n > 0} is \tcode{true},
947+
equivalent to
948+
\tcode{start_lifetime_as<U>(p)}
938949
where \tcode{U} is the type ``array of \tcode{n} \tcode{T}''.
950+
Otherwise, there are no effects.
951+
952+
\pnum
953+
\returns
954+
A pointer to the first element of the array,
955+
if any;
956+
otherwise,
957+
a pointer that compares equal to \tcode{p}\iref{expr.eq}.
939958
\end{itemdescr}
940959

941960
\rSec2[allocator.tag]{Allocator argument tag}

0 commit comments

Comments
 (0)