Skip to content

Commit

Permalink
[string.cons] Replace postcondition tables by ordinary Postcondition …
Browse files Browse the repository at this point in the history
…elements
  • Loading branch information
tkoeppe authored and zygoloid committed Dec 5, 2017
1 parent 0abe2f3 commit 83e302d
Showing 1 changed file with 67 additions and 118 deletions.
185 changes: 67 additions & 118 deletions source/strings.tex
Expand Up @@ -1198,15 +1198,12 @@
\begin{itemdescr}
\pnum
\effects
Constructs an object of class
\tcode{basic_string}.
The postconditions of this function are indicated in Table~\ref{tab:strings.ctr.1}.
Constructs an object of class \tcode{basic_string}.

\begin{libefftabvalue}{\tcode{basic_string(const Allocator\&)} effects}{tab:strings.ctr.1}
\tcode{data()} & a non-null pointer that is copyable and can have 0 added to it \\ \rowsep
\tcode{size()} & 0 \\ \rowsep
\tcode{capacity()} & an unspecified value \\
\end{libefftabvalue}
\pnum
\postconditions
\tcode{data()} is a non-null pointer that is copyable and can have \tcode{0} added
to it, \tcode{size()} is \tcode{0}, and \tcode{capacity()} is an unspecified value.
\end{itemdescr}

\indexlibrary{\idxcode{basic_string}!constructor}%
Expand All @@ -1218,21 +1215,16 @@
\begin{itemdescr}
\pnum
\effects
Constructs an object of class
\tcode{basic_string}
as indicated in Table~\ref{tab:strings.ctr.cpy}.
In the second form, \tcode{str}
is left in a valid state with an unspecified value.
Constructs an object of class \tcode{basic_string}.

\begin{libefftabvalue}
{\tcode{basic_string(const basic_string\&)} effects}
{tab:strings.ctr.cpy}
\tcode{data()} & points at the first element of an allocated
copy of the array whose first element is
pointed at by \tcode{str.data()} \\
\tcode{size()} & \tcode{str.size()} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\end{libefftabvalue}
\pnum
\postconditions
\tcode{data()} points at the first element of an allocated copy
of the array whose first element is pointed at by the original
value \tcode{str.data()}, \tcode{size()} is equal to the
original value of \tcode{str.size()}, and \tcode{capacity()} is a value
at least as large as \tcode{size()}.
In the second form, \tcode{str} is left in a valid state with an unspecified value.
\end{itemdescr}

\indexlibrary{\idxcode{basic_string}!constructor}%
Expand All @@ -1256,19 +1248,14 @@
\tcode{basic_string}
and determines the effective length \tcode{rlen} of the initial string
value as \tcode{str.size() - pos} in the first form and
as the smaller of \tcode{str.size() - pos} and \tcode{n} in the second form,
as indicated in Table~\ref{tab:strings.ctr.2}.
as the smaller of \tcode{str.size() - pos} and \tcode{n} in the second form.

\begin{libefftabvalue}
{\tcode{basic_string(const basic_string\&, size_type, const Allocator\&)}\protect\mbox{ }and\protect\linebreak
\tcode{basic_string(const basic_string\&, size_type, size_type, const Allocator\&)} effects}
{tab:strings.ctr.2}
\tcode{data()} &
points at the first element of an allocated copy of \tcode{rlen} consecutive elements
of the string controlled by \tcode{str} beginning at position \tcode{pos} \\
\tcode{size()} & \tcode{rlen} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\end{libefftabvalue}
\pnum
\postconditions
\tcode{data()} points at the first element of an allocated copy of \tcode{rlen}
consecutive elements of the string controlled by \tcode{str} beginning at position
\tcode{pos}, \tcode{size()} is equal to \tcode{rlen}, and \tcode{capacity()} is a
value at least as large as \tcode{size()}.
\end{itemdescr}

\indexlibrary{\idxcode{basic_string}!constructor}%
Expand Down Expand Up @@ -1314,22 +1301,16 @@

\pnum
\effects
Constructs an object of class
\tcode{basic_string}
Constructs an object of class \tcode{basic_string}
and determines its initial string value from the array of
\tcode{charT}
of length \tcode{n} whose first element is designated by \tcode{s},
as indicated in Table~\ref{tab:strings.ctr.3}.
\tcode{charT} of length \tcode{n} whose first element is designated by \tcode{s}.

\begin{libefftabvalue}
{\tcode{basic_string(const charT*, size_type, const Allocator\&)} effects}
{tab:strings.ctr.3}
\tcode{data()} &
points at the first element of an allocated copy of the array whose first element
is pointed at by \tcode{s} \\
\tcode{size()} & \tcode{n} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\end{libefftabvalue}
\pnum
\postconditions
\tcode{data()} points at the first element of an allocated copy
of the array whose first element is pointed at by \tcode{s},
\tcode{size()} is equal to \tcode{n}, and \tcode{capacity()} is
a value at least as large as \tcode{size()}.
\end{itemdescr}

\indexlibrary{\idxcode{basic_string}!constructor}%
Expand All @@ -1345,25 +1326,17 @@

\pnum
\effects
Constructs an object of class
\tcode{basic_string}
Constructs an object of class \tcode{basic_string}
and determines its initial string value from the array of
\tcode{charT}
of length
\tcode{traits::length(s)}
whose first element is designated
by \tcode{s},
as indicated in Table~\ref{tab:strings.ctr.4}.

\begin{libefftabvalue}
{\tcode{basic_string(const charT*, const Allocator\&)} effects}
{tab:strings.ctr.4}
\tcode{data()} &
points at the first element of an allocated copy of the array whose first element
is pointed at by \tcode{s} \\
\tcode{size()} & \tcode{traits::length(s)} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\end{libefftabvalue}
\tcode{charT} of length \tcode{traits::length(s)}
whose first element is designated by \tcode{s}.

\pnum
\postconditions
\tcode{data()} points at the first element of an allocated copy
of the array whose first element is pointed at by \tcode{s},
\tcode{size()} is equal to \tcode{traits::length(s)}, and
\tcode{capacity()} is a value at least as large as \tcode{size()}.
\end{itemdescr}

\indexlibrary{\idxcode{basic_string}!constructor}%
Expand All @@ -1378,21 +1351,16 @@

\pnum
\effects
Constructs an object of class
\tcode{basic_string}
Constructs an object of class \tcode{basic_string}
and determines its initial string value by repeating the char-like
object \tcode{c} for all \tcode{n} elements,
as indicated in Table~\ref{tab:strings.ctr.5}.
object \tcode{c} for all \tcode{n} elements.

\begin{libefftabvalue}
{\tcode{basic_string(size_t, charT, const Allocator\&)} effects}
{tab:strings.ctr.5}
\tcode{data()} &
points at the first element of an allocated array of \tcode{n} elements, each
storing the initial value \tcode{c} \\
\tcode{size()} & \tcode{n} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\end{libefftabvalue}
\pnum
\postconditions
\tcode{data()} points at the first element of an allocated array
of \tcode{n} elements, each storing the initial value \tcode{c},
\tcode{size()} is equal to \tcode{n}, and
\tcode{capacity()} is a value at least as large as \tcode{size()}.
\end{itemdescr}

\indexlibrary{\idxcode{basic_string}!constructor}%
Expand Down Expand Up @@ -1433,22 +1401,19 @@

\begin{itemdescr}
\pnum
\effects Constructs an object of class \tcode{basic_string} as indicated in
Table~\ref{tab:strings.ctr.6}. The stored allocator is constructed from
\tcode{alloc}. In the second form, \tcode{str} is left in a valid state with an
unspecified value.
\effects Constructs an object of class \tcode{basic_string}.
The stored allocator is constructed from \tcode{alloc}.

\begin{libefftabvalue}
{\tcode{basic_string(const basic_string\&, const Allocator\&)}\protect\linebreak and
\tcode{basic_string(basic_string\&\&, const Allocator\&)} effects}
{tab:strings.ctr.6}
\tcode{data()} &
points at the first element of an allocated copy of the array whose first
element is pointed at by the original value of \tcode{str.data()}. \\
\tcode{size()} & the original value of \tcode{str.size()} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\tcode{get_allocator()} & \tcode{alloc} \\
\end{libefftabvalue}
\pnum
\postconditions
\tcode{data()} points at the first element of an allocated copy
of the array whose first element is pointed at by the original
value of \tcode{str.data()}, \tcode{size()} is equal to the
original value of \tcode{str.size()}, \tcode{capacity()} is a value
at least as large as \tcode{size()}, and \tcode{get_allocator()} is
equal to \tcode{alloc}.
In the second form, \tcode{str} is left in a valid state with an
unspecified value.

\pnum
\throws The second form throws nothing if \tcode{alloc == str.get_allocator()}.
Expand Down Expand Up @@ -1476,34 +1441,18 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
If
\tcode{*this}
and \tcode{str} are not the same object,
modifies
\tcode{*this}
as shown in Table~\ref{tab:strings.op=}.

\pnum
If
\tcode{*this}
and \tcode{str} are the same object,
the member has no effect.

\pnum
\returns
\tcode{*this}.

\begin{libefftabvalue}
{\tcode{operator=(const basic_string\&)} effects}
{tab:strings.op=}
\tcode{data()} &
points at the first element of an allocated copy of the array whose first
element is pointed at by \tcode{str.data()} \\
\tcode{size()} & \tcode{str.size()} \\
\tcode{capacity()} & a value at least as large as \tcode{size()} \\
\end{libefftabvalue}
\pnum
\postconditions
If \tcode{*this} and \tcode{str} are the same object, the member has no effect.
Otherwise,
\tcode{data()} points at the first element of an allocated copy
of the array whose first element is pointed at by \tcode{str.data()},
\tcode{size()} is equal to \tcode{str.size()}, and
\tcode{capacity()} is a value at least as large as \tcode{size()}.
\end{itemdescr}

\indexlibrarymember{operator=}{basic_string}%
Expand Down

0 comments on commit 83e302d

Please sign in to comment.