Skip to content

Commit ac47f9c

Browse files
AlisdairMtkoeppe
authored andcommitted
[container.reqmts] Move requirements to the right place (cplusplus#6199)
As part of the replacement of the container requirements tables with text, several paragraphs of general container requirements were buried in the new subsections for more specific requirements such as reversible containers or allocator-aware containers. This seems to have happened when general container requirements followed one of the container requirements tables that are now expressed as text. This change carefully restores text to the general container requirements clause, in the original order they appeared in C++20.
1 parent 562af66 commit ac47f9c

File tree

1 file changed

+69
-67
lines changed

1 file changed

+69
-67
lines changed

source/containers.tex

Lines changed: 69 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,57 @@
636636
with value \tcode{a.end()} before the swap will have value \tcode{b.end()} after the
637637
swap.
638638

639+
\pnum
640+
Unless otherwise specified (see~\ref{associative.reqmts.except}, \ref{unord.req.except}, \ref{deque.modifiers}, and
641+
\ref{vector.modifiers})
642+
all container types defined in this Clause meet
643+
the following additional requirements:
644+
645+
\begin{itemize}
646+
\item
647+
If an exception is thrown by an
648+
\tcode{insert()} or \tcode{emplace()}
649+
function while inserting a single element, that
650+
function has no effects.
651+
\item
652+
If an exception is thrown by a
653+
\tcode{push_back()},
654+
\tcode{push_front()},
655+
\tcode{emplace_back()}, or \tcode{emplace_front()}
656+
function, that function has no effects.
657+
\item
658+
No
659+
\tcode{erase()},
660+
\tcode{clear()},
661+
\tcode{pop_back()}
662+
or
663+
\tcode{pop_front()}
664+
function throws an exception.
665+
\item
666+
No copy constructor or assignment operator of a returned iterator
667+
throws an exception.
668+
\item
669+
No
670+
\tcode{swap()}
671+
function throws an exception.
672+
\item
673+
No
674+
\tcode{swap()}
675+
function invalidates any references,
676+
pointers, or iterators referring to the elements
677+
of the containers being swapped.
678+
\begin{note}
679+
The \tcode{end()} iterator does not refer to any element, so it can be invalidated.
680+
\end{note}
681+
\end{itemize}
682+
683+
\pnum
684+
Unless otherwise specified (either explicitly or by defining a
685+
function in terms of other functions), invoking a container member
686+
function or passing a container as an argument to a library function
687+
shall not invalidate iterators to, or change the values of, objects
688+
within that container.
689+
639690
\pnum
640691
A \defnadj{contiguous}{container}
641692
is a container
@@ -644,6 +695,24 @@
644695
\oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators} and
645696
model \libconcept{contiguous_iterator}\iref{iterator.concept.contiguous}.
646697

698+
\pnum
699+
The behavior of certain container member functions and deduction guides
700+
depends on whether types qualify as input iterators or allocators.
701+
The extent to which an implementation determines that a type cannot be an input
702+
iterator is unspecified, except that as a minimum integral types shall not qualify
703+
as input iterators.
704+
Likewise, the extent to which an implementation determines that a type cannot be
705+
an allocator is unspecified, except that as a minimum a type \tcode{A} shall not qualify
706+
as an allocator unless it meets both of the following conditions:
707+
708+
\begin{itemize}
709+
\item The \grammarterm{qualified-id} \tcode{A::value_type}
710+
is valid and denotes a type\iref{temp.deduct}.
711+
712+
\item The expression \tcode{declval<A\&>().allocate(size_t\{\})}
713+
is well-formed when treated as an unevaluated operand.
714+
\end{itemize}
715+
647716
\rSec3[container.rev.reqmts]{Reversible container requirements}
648717

649718
% Local command to index names as members of all containers.
@@ -774,56 +843,6 @@
774843
Constant.
775844
\end{itemdescr}
776845

777-
\pnum
778-
Unless otherwise specified (see~\ref{associative.reqmts.except}, \ref{unord.req.except}, \ref{deque.modifiers}, and
779-
\ref{vector.modifiers})
780-
all container types defined in this Clause meet
781-
the following additional requirements:
782-
783-
\begin{itemize}
784-
\item
785-
If an exception is thrown by an
786-
\tcode{insert()} or \tcode{emplace()}
787-
function while inserting a single element, that
788-
function has no effects.
789-
\item
790-
If an exception is thrown by a
791-
\tcode{push_back()},
792-
\tcode{push_front()},
793-
\tcode{emplace_back()}, or \tcode{emplace_front()}
794-
function, that function has no effects.
795-
\item
796-
No
797-
\tcode{erase()},
798-
\tcode{clear()},
799-
\tcode{pop_back()}
800-
or
801-
\tcode{pop_front()}
802-
function throws an exception.
803-
\item
804-
No copy constructor or assignment operator of a returned iterator
805-
throws an exception.
806-
\item
807-
No
808-
\tcode{swap()}
809-
function throws an exception.
810-
\item
811-
No
812-
\tcode{swap()}
813-
function invalidates any references,
814-
pointers, or iterators referring to the elements
815-
of the containers being swapped.
816-
\begin{note}
817-
The \tcode{end()} iterator does not refer to any element, so it can be invalidated.
818-
\end{note}
819-
\end{itemize}
820-
821-
\pnum
822-
Unless otherwise specified (either explicitly or by defining a
823-
function in terms of other functions), invoking a container member
824-
function or passing a container as an argument to a library function
825-
shall not invalidate iterators to, or change the values of, objects
826-
within that container.
827846

828847
\rSec3[container.opt.reqmts]{Optional container requirements}
829848

@@ -1192,23 +1211,6 @@
11921211
Constant.
11931212
\end{itemdescr}
11941213

1195-
\pnum
1196-
The behavior of certain container member functions and deduction guides
1197-
depends on whether types qualify as input iterators or allocators.
1198-
The extent to which an implementation determines that a type cannot be an input
1199-
iterator is unspecified, except that as a minimum integral types shall not qualify
1200-
as input iterators.
1201-
Likewise, the extent to which an implementation determines that a type cannot be
1202-
an allocator is unspecified, except that as a minimum a type \tcode{A} shall not qualify
1203-
as an allocator unless it meets both of the following conditions:
1204-
1205-
\begin{itemize}
1206-
\item The \grammarterm{qualified-id} \tcode{A::value_type}
1207-
is valid and denotes a type\iref{temp.deduct}.
1208-
1209-
\item The expression \tcode{declval<A\&>().allocate(size_t\{\})}
1210-
is well-formed when treated as an unevaluated operand.
1211-
\end{itemize}
12121214

12131215
\rSec2[container.requirements.dataraces]{Container data races}
12141216

0 commit comments

Comments
 (0)