---
name: "std::fpos"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::fpos"
---

# std::fpos(3)

Class representing stream positions.

## NAME

std::fpos\< \_StateT \> - Class representing stream positions.

## SYNOPSIS

\#include \<string\>

### Public Member Functions

**fpos** (const fpos &)=default\
 **fpos** (**streamoff** \_\_off)\
 Construct position from offset.  **operator streamoff** () const\
 Convert to streamoff.  fpos **operator+** (**streamoff** \_\_off) const\
 Add position and offset.  fpos & **operator+=** (**streamoff** \_\_off)\
 Add offset to this position.  **streamoff** **operator-** (const fpos &\_\_other) const\
 Subtract position to return offset.  fpos **operator-** (**streamoff** \_\_off) const\
 Subtract offset from position.  fpos & **operator-=** (**streamoff** \_\_off)\
 Subtract offset from this position.  fpos & **operator=** (const fpos &)=default\
 \_StateT **state** () const\
 Return the last set value of *st*.  void **state** (\_StateT \_\_st)\
 Remember the value of *st*.

## Detailed Description

### template\<typename \_StateT\>

class std::fpos\< \_StateT \>"Class representing stream positions.

The standard places no requirements upon the template parameter StateT. 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.

**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.

## Member Function Documentation

### template\<typename \_StateT\> std::fpos\< \_StateT \>::operator streamoff () const \[inline\]

Convert to streamoff.

### template\<typename \_StateT\> fpos std::fpos\< \_StateT \>::operator+ (streamoff \_\_off) const \[inline\]

Add position and offset.

### template\<typename \_StateT\> fpos & std::fpos\< \_StateT \>::operator+= (streamoff \_\_off) \[inline\]

Add offset to this position.

### template\<typename \_StateT\> streamoff std::fpos\< \_StateT \>::operator- (const fpos\< \_StateT \> & \_\_other) const \[inline\]

Subtract position to return offset.

### template\<typename \_StateT\> fpos std::fpos\< \_StateT \>::operator- (streamoff \_\_off) const \[inline\]

Subtract offset from position.

### template\<typename \_StateT\> fpos & std::fpos\< \_StateT \>::operator-= (streamoff \_\_off) \[inline\]

Subtract offset from this position.

### template\<typename \_StateT\> \_StateT std::fpos\< \_StateT \>::state () const \[inline\]

Return the last set value of *st*.

### template\<typename \_StateT\> void std::fpos\< \_StateT \>::state (\_StateT \_\_st) \[inline\]

Remember the value of *st*.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
