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