Skip to content

Commit f2ee36c

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 f2ee36c

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

source/memory.tex

Lines changed: 24 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\iref{term.incomplete.type}.
882883

883884
\pnum
884885
\expects
@@ -927,15 +928,34 @@
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+
If \tcode{n > 0} is \tcode{true},
940+
\range{(char*)p}{(char*)p + (n * sizeof(T))} denotes
941+
a region of allocated storage that is
942+
a subset of the region of storage
943+
reachable through\iref{basic.compound} \tcode{p}.
933944

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

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

0 commit comments

Comments
 (0)