[fpos] (original) (raw)
31 Input/output library [input.output]
31.5 Iostreams base classes [iostreams.base]
31.5.3 Class template fpos [fpos]
31.5.3.1 General [fpos.general]
namespace std { template<class stateT> class fpos { public: stateT state() const;void state(stateT);private: stateT st; };}
31.5.3.2 Members [fpos.members]
Effects: Assigns s to st.
Returns: Current value of st.
31.5.3.3 Requirements [fpos.operations]
An fpos type specifies file position information.
It holds a state object whose type is equal to the template parameter stateT.
If is_trivially_copy_constructible_v<stateT> is true, then fpos<stateT> has a trivial copy constructor.
If is_trivially_copy_assignable_v<stateT> is true, then fpos<stateT> has a trivial copy assignment operator.
If is_trivially_destructible_v<stateT> is true, then fpos<stateT> has a trivial destructor.
In addition, the expressions shown in Table 139are valid and have the indicated semantics.
In that table,
- P refers to a specialization of fpos,
- p and q refer to values of type P or const P,
- pl and ql refer to modifiable lvalues of type P,
- O refers to type streamoff, and
- o and o2 refer to values of type streamoff or const streamoff.
Table 139 β Position type requirements [tab:fpos.operations]
πExpression | Return type | Operational | Assertion/note |
---|---|---|---|
π | semantics | pre-/post-condition | |
πP(o) | P | converts from offset | Effects: Value-initializes the state object. |
πP p(o);P p = o; | Effects: Value-initializes the state object. Postconditions: p == P(o) is true. | ||
πP() | P | P(0) | |
πP p; | P p(0); | ||
πO(p) | streamoff | converts to offset | P(O(p)) == p |
πp == q | bool | Remarks: For any two values o and o2, if p is obtained from o converted to P or from a copy of such P value and if q is obtained from o2 converted to P or from a copy of such P value, then p == q is true only if o == o2 is true. | |
πp != q | bool | !(p == q) | |
πp + o | P | + offset | Remarks: With ql = p + o;, then: ql - o == p |
πpl += o | P& | += offset | Remarks: With ql = pl; before the +=, then:pl - o == ql |
πp - o | P | - offset | Remarks: With ql = p - o;, then: ql + o == p |
πpl -= o | P& | -= offset | Remarks: With ql = pl; before the -=, then:pl + o == ql |
πo + p | convertible to P | p + o | P(o + p) == p + o |
πp - q | streamoff | distance | p == q + (p - q) |
Stream operations that return a value of typetraitsβ::βpos_typereturnP(O(-1))as an invalid value to signal an error.
If this value is used as an argument to anyistream,ostream, orstreambuf member that accepts a value of typetraitsβ::βpos_typethen the behavior of that function is undefined.