SysTutorials

Linux Manual Pages › Section 3

stdfpos(3)

std::fpos - std::fpos

Synopsis

Defined in header <ios>
template< class State >
class fpos;

Specializations of the class template std::fpos identify absolute positions in a stream or in a file. Each object of type fpos holds the byte position in the stream (typically as a private member of type std::streamoff) and the current shift state, a value of type State (typically std::mbstate_t). The following specializations of std::fpos are provided: Type Definition streampos std::fpos<std::char_traits<char>::state_type> wstreampos std::fpos<std::char_traits<wchar_t>::state_type> u8streampos (since C++20) std::fpos<std::char_traits<char8_t>::state_type> u16streampos (since C++11) std::fpos<std::char_traits<char16_t>::state_type> u32streampos (since C++11) std::fpos<std::char_traits<char32_t>::state_type> All specializations of fpos meet the DefaultConstructible, CopyConstructible, CopyAssignable, Destructible, and EqualityComparable requirements. If State is trivially copy constructible, fpos has a trivial copy constructor. If State is trivially copy assignable, fpos has a trivial copy assignment operator. If State is trivially destructible, fpos has a trivial destructor. Template parameter State - the type representing the shift state

Type requirements

State must meet the requirements of Destructible, CopyAssignable, CopyConstructible and DefaultConstructible.

Member functions

      gets/sets the value of the shift state state (public member function)

In addition, member and non-member functions are provided to support the following operations:

      * p + o has type fpos<State> and stores an offset that is the result of adding o to the offset of p       * o + p has a type convertible to fpos<State> and the result of the conversion is equal to p + o       * p - o has type fpos<State> and stores an offset that is the result of subtracting o from the offset of p

Notes

Defect reports The following behavior-changing defect reports were applied retroactively to previously published C++ standards. DR Applied to Behavior as published Correct behavior P0759R1 C++98 specification was unclear and incomplete cleaned up P1148R0 C++11 unclear what header defines u16streampos and u32streampos or what their definitions are made clear

See also

          represents relative file/stream position (offset from fpos), sufficient to represent any file size streamoff (typedef)           returns the output position indicator tellp (public member function of std::basic_ostream<CharT,Traits>)           sets the output position indicator seekp (public member function of std::basic_ostream<CharT,Traits>)           gets the file position indicator fgetpos (function)