|
1655 | 1655 | \pnum
|
1656 | 1656 | \indexlibrary{\idxcode{fpos}}%
|
1657 | 1657 | \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. |
1659 | 1680 | In that table,
|
1660 | 1681 | \begin{itemize}
|
1661 | 1682 | \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}. |
1667 | 1689 | \end{itemize}
|
1668 | 1690 |
|
1669 | 1691 | \begin{libreqtab4c}
|
|
1678 | 1700 | \lhdr{Expression} & \chdr{Return type} & \chdr{Operational} & \rhdr{Assertion/note} \\
|
1679 | 1701 | & & \chdr{semantics} & \rhdr{pre-/post-condition} \\ \capsep
|
1680 | 1702 | \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 |
1691 | 1703 | \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 |
1694 | 1721 | \tcode{O(p)} &
|
1695 | 1722 | \tcode{streamoff} &
|
1696 | 1723 | converts to \tcode{offset} &
|
1697 | 1724 | \tcode{P(O(p)) == p} \\ \rowsep
|
1698 |
| -\tcode{p == q} & |
1699 |
| - convertible to \tcode{bool} & |
1700 |
| - & |
1701 |
| - \tcode{==} is an equivalence relation \\ \rowsep |
1702 | 1725 | \tcode{p != q} &
|
1703 | 1726 | convertible to \tcode{bool} &
|
1704 | 1727 | \tcode{!(p == q)} & \\ \rowsep
|
1705 |
| -\tcode{q = p + o}\br |
1706 |
| -\tcode{p += o} & |
1707 |
| - \tcode{fpos} & |
| 1728 | +\tcode{p + o} & |
| 1729 | + \tcode{P} & |
1708 | 1730 | \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} & |
1713 | 1739 | \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} & |
1716 | 1751 | \tcode{streamoff} &
|
1717 | 1752 | 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 |
1727 | 1754 | \end{libreqtab4c}
|
1728 | 1755 |
|
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 |
| - |
1740 | 1756 | \pnum
|
1741 | 1757 | Stream operations that return a value of type
|
1742 | 1758 | \tcode{traits::pos_type}
|
|
0 commit comments