STD::FPOS(3cxx)
π¦ std::fpos< _StateT > β the 3cxx page, but make it make sense π
okay bestie, gather round, because we're talking about std::fpos< _StateT >, which is literally the class that represents stream positions. yes, like where you are in a stream. main character energy for your file offsets. no cap, this one's actually kind of iconic once you get it π
β¨ NAME β¨
std::fpos< _StateT > β Class representing stream positions. that's it, that's the whole vibe. it holds a position, it holds a state, and it does math with offsets. slay.
πΈ SYNOPSIS πΈ
#include <string>
π Public Member Functions
fpos (const fpos &)=defaultβ the defaulted copy constructor, doing exactly what you'd expect, zero drama β¨fpos (streamoff __off)β Construct position from offset. give it an offset, get a position πoperator streamoff () constβ Convert to streamoff. turns the whole position into a plain offset.fpos operator+ (streamoff __off) constβ Add position and offset. position plus offset, new position, boom π₯fpos & operator+= (streamoff __off)β Add offset to this position. mutates this and hands it back to you.streamoff operator- (const fpos &__other) constβ Subtract position to return offset. two positions go in, one offset comes out πfpos operator- (streamoff __off) constβ Subtract offset from position. position minus offset, fresh position.fpos & operator-= (streamoff __off)β Subtract offset from this position. in-place, bestie, no copies needed.fpos & operator= (const fpos &)=defaultβ the defaulted copy assignment, also living its best defaulted life π_StateT state () constβ Return the last set value of st. the vibe check for your stored state π«Άvoid state (_StateT __st)β Remember the value of st. tuck that state away for later π
π Detailed Description
template<typename _StateT>
class std::fpos< _StateT >"Class representing stream positions.
(that stray quote mark is canon, don't come for me π it's in the source, we keep it. every detail, always.)
so here's the tea: the standard places no requirements upon the template parameter StateT. none. zero. the standard said "you do you, StateT." πΈ
But β and this is the important part, so like, pay attention β in this implementation, StateT must be DefaultConstructible, CopyConstructible and Assignable. the standard only requires that fpos should contain a member of type StateT. in this implementation it also contains an offset stored as a signed integer. extra storage, extra slay π
π¦ Parameters
- StateT β Type passed to and returned from
state().
π§ Constructor & Destructor Documentation
π template<typename _StateT > std::fpos< _StateT >::fpos (streamoff __off)
[inline]
Construct position from offset. hand over an offset, receive a position. it's giving "factory but make it a constructor" β¨
β Member Function Documentation
π template<typename _StateT > std::fpos< _StateT >::operator streamoff () const
[inline]
Convert to streamoff. yes, it's a conversion operator, yes it's const, yes it's inline. obsessed π«Ά
π template<typename _StateT > fpos std::fpos< _StateT >::operator+ (streamoff __off) const
[inline]
Add position and offset. returns a fresh fpos, doesn't touch the original. polite behavior honestly πΈ
π₯ template<typename _StateT > fpos & std::fpos< _StateT >::operator+= (streamoff __off)
[inline]
Add offset to this position. returns fpos &, so you can chain it like a menace. ate π
π template<typename _StateT > streamoff std::fpos< _StateT >::operator- (const fpos< _StateT > & __other) const
[inline]
Subtract position to return offset. note the return type: streamoff, not an fpos. you're getting the distance, not a new place to stand. iykyk π
π template<typename _StateT > fpos std::fpos< _StateT >::operator- (streamoff __off) const
[inline]
Subtract offset from position. new fpos, original untouched, no cap β¨
πΈ template<typename _StateT > fpos & std::fpos< _StateT >::operator-= (streamoff __off)
[inline]
Subtract offset from this position. in-place, returns fpos &, same energy as += but backwards. iconic π
π¦ template<typename _StateT > _StateT std::fpos< _StateT >::state () const
[inline]
Return the last set value of st. getter era π«Ά
π template<typename _StateT > void std::fpos< _StateT >::state (_StateT __st)
[inline]
Remember the value of st. setter era. stores it right there in the object π
β¨ Author β¨
Generated automatically by Doxygen for libstdc++ from the source code. (not a human, not a girlie, just Doxygen doing its thing π)
bestie reminder: every one of these members is[inline], and the copy constructor and copy assignment are=default. don't overthink it, that's literally the whole spec π
and that's the page! footer time: this one's from libstdc++, dated std::fpos< _StateT >(3cxx) β okay that's the header sneaking back in, but you get it. libstdc++ certified, 3cxx approved, go forth and seek your streams πβ¨π
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms