Skip to content

Commit 7e1d19c

Browse files
authored
Merge 2018-06 LWG Motion 17
Fixes #2134
2 parents 8702000 + 5f7b20b commit 7e1d19c

File tree

1 file changed

+67
-51
lines changed

1 file changed

+67
-51
lines changed

source/iostreams.tex

Lines changed: 67 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,15 +1655,37 @@
16551655
\pnum
16561656
\indexlibrary{\idxcode{fpos}}%
16571657
\indexlibrary{\idxcode{streamoff}}%
1658-
Operations specified in \tref{iostreams.position.requirements} are permitted.
1658+
An \tcode{fpos} type specifies file position information.
1659+
It holds a state object
1660+
whose type is equal to the template parameter \tcode{stateT}.
1661+
Type \tcode{stateT} shall meet
1662+
the \tcode{DefaultConstructible} (\tref{defaultconstructible}),
1663+
\tcode{CopyConstructible} (\tref{copyconstructible}),
1664+
\tcode{CopyAssignable} (\tref{copyassignable}), and
1665+
\tcode{Destructible} (\tref{destructible}) requirements.
1666+
If \tcode{is_trivially_copy_constructible_v<stateT>} is \tcode{true},
1667+
then \tcode{fpos<stateT>} has a trivial copy constructor.
1668+
If \tcode{is_trivially_copy_assignable<stateT>} is \tcode{true},
1669+
then \tcode{fpos<stateT>} has a trivial copy assignment operator.
1670+
If \tcode{is_trivially_destructible_v<stateT>} is \tcode{true},
1671+
then \tcode{fpos<stateT>} has a trivial destructor.
1672+
All specializations of \tcode{fpos} satisfy
1673+
the \tcode{DefaultConstructible},
1674+
\tcode{CopyConstructible},
1675+
\tcode{CopyAssignable},
1676+
\tcode{Destructible},
1677+
and \tcode{EqualityComparable} (\tref{equalitycomparable}) requirements.
1678+
In addition, the expressions shown in \tref{iostreams.position.requirements}
1679+
are valid and have the indicated semantics.
16591680
In that table,
16601681
\begin{itemize}
16611682
\item \tcode{P} refers to an instance of \tcode{fpos},
1662-
\item \tcode{p} and \tcode{q} refer to values of type \tcode{P},
1663-
\item \tcode{O} refers to type \tcode{streamoff},
1664-
\item \tcode{o} refers to a value of type \tcode{streamoff},
1665-
\item \tcode{sz} refers to a value of type \tcode{streamsize} and
1666-
\item \tcode{i} refers to a value of type \tcode{int}.
1683+
\item \tcode{p} and \tcode{q} refer to values
1684+
of type \tcode{P} or \tcode{const P},
1685+
\item \tcode{pl} and \tcode{ql} refer to modifiable lvalues of type \tcode{P},
1686+
\item \tcode{O} refers to type \tcode{streamoff}, and
1687+
\item \tcode{o} refers to a value
1688+
of type \tcode{streamoff} or \tcode{const streamoff}.
16671689
\end{itemize}
16681690

16691691
\begin{libreqtab4c}
@@ -1678,65 +1700,59 @@
16781700
\lhdr{Expression} & \chdr{Return type} & \chdr{Operational} & \rhdr{Assertion/note} \\
16791701
& & \chdr{semantics} & \rhdr{pre-/post-condition} \\ \capsep
16801702
\endhead
1681-
\tcode{P(i)} &
1682-
&
1683-
&
1684-
\tcode{p == P(i)}\br
1685-
note: a destructor is assumed. \\ \rowsep
1686-
\tcode{P p(i);}\br
1687-
\tcode{P p = i;} &
1688-
&
1689-
&
1690-
\postconditions \tcode{p == P(i)}. \\ \rowsep
16911703
\tcode{P(o)} &
1692-
\tcode{fpos} &
1693-
converts from \tcode{offset} & \\ \rowsep
1704+
\tcode{P} &
1705+
converts from \tcode{offset} &
1706+
\effects Value-initializes the state object. \\ \rowsep
1707+
\tcode{P p(o);}\br
1708+
\tcode{P p = o;} &
1709+
&
1710+
&
1711+
\effects Value-initializes the state object. \br
1712+
\postconditions \tcode{p == P(o)} \\ \rowsep
1713+
\tcode{P()} &
1714+
\tcode{P} &
1715+
\tcode{P(0)} &
1716+
\\ \rowsep
1717+
\tcode{P p;} &
1718+
&
1719+
\tcode{P p(0);} &
1720+
\\ \rowsep
16941721
\tcode{O(p)} &
16951722
\tcode{streamoff} &
16961723
converts to \tcode{offset} &
16971724
\tcode{P(O(p)) == p} \\ \rowsep
1698-
\tcode{p == q} &
1699-
convertible to \tcode{bool} &
1700-
&
1701-
\tcode{==} is an equivalence relation \\ \rowsep
17021725
\tcode{p != q} &
17031726
convertible to \tcode{bool} &
17041727
\tcode{!(p == q)} & \\ \rowsep
1705-
\tcode{q = p + o}\br
1706-
\tcode{p += o} &
1707-
\tcode{fpos} &
1728+
\tcode{p + o} &
1729+
\tcode{P} &
17081730
\tcode{+} offset &
1709-
\tcode{q - o == p} \\ \rowsep
1710-
\tcode{q = p - o}\br
1711-
\tcode{p -= o} &
1712-
\tcode{fpos} &
1731+
\remarks With \tcode{ql = p + o;}, then: \tcode{ql - o == p} \\ \rowsep
1732+
\tcode{pl += o} &
1733+
\tcode{P\&} &
1734+
\tcode{+=} offset &
1735+
\remarks With \tcode{ql = pl;} before the \tcode{+=}, then:
1736+
\tcode{pl - o == ql} \\ \rowsep
1737+
\tcode{p - o} &
1738+
\tcode{P} &
17131739
\tcode{-} offset &
1714-
\tcode{q + o == p} \\ \rowsep
1715-
\tcode{o = p - q} &
1740+
\remarks With \tcode{ql = p - o;}, then: \tcode{ql + o == p} \\ \rowsep
1741+
\tcode{pl -= o} &
1742+
\tcode{P\&} &
1743+
\tcode{-=} offset &
1744+
\remarks With \tcode{ql = pl;} before the \tcode{-=}, then:
1745+
\tcode{pl + o == ql} \\ \rowsep
1746+
\tcode{o + p} &
1747+
convertible to \tcode{P} &
1748+
\tcode{p + o} &
1749+
\tcode{P(o + p) == p + o} \\ \rowsep
1750+
\tcode{p - q} &
17161751
\tcode{streamoff} &
17171752
distance &
1718-
\tcode{q + o == p} \\ \rowsep
1719-
\tcode{streamsize(o)}\br
1720-
\tcode{O(sz)} &
1721-
\tcode{streamsize}\br
1722-
\tcode{streamoff} &
1723-
converts\br
1724-
converts &
1725-
\tcode{streamsize(O(sz)) == sz}\br
1726-
\tcode{streamsize(O(sz)) == sz} \\
1753+
\tcode{p == q + (p - q)} \\ \rowsep
17271754
\end{libreqtab4c}
17281755

1729-
\pnum
1730-
\begin{note}
1731-
Every implementation is required to supply overloaded operators on
1732-
\tcode{fpos}
1733-
objects to satisfy the requirements of~\ref{fpos.operations}.
1734-
It is unspecified whether these operators are members of
1735-
\tcode{fpos},
1736-
global operators,
1737-
or provided in some other way.
1738-
\end{note}
1739-
17401756
\pnum
17411757
Stream operations that return a value of type
17421758
\tcode{traits::pos_type}

0 commit comments

Comments
 (0)