std::fpos<State>::state
From cppreference.com
 
 
 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Input/output library 
 
 
 
 
 
 
 
 
 
 
 
 
 Print functions (C++23)
 Buffers
(C++23)
(C++98/26*)
(C++20)
 Streams
 Abstractions
 File I/O
 String I/O
 Array I/O
(C++23)
(C++23)
(C++23)
(C++98/26*)
(C++98/26*)
(C++98/26*)
 Synchronized Output
(C++20)
 Types
 Error category interface
(C++11)
(C++11)
State state() const;
 (1) 
 
void state( State st );
 (2) 
 
Manages the file position state.
1) Returns the value of the file position state.
2) Replaces the file position state with the value of st.
For the specializations of std::fpos  that are used in the standard library, State is always std::mbstate_t .
[edit] Parameters
 st
 -
 new value for the state
[edit] Return value
1) The current value of the 
fpos state.2) (none)
[edit] Example
Run this code
#include <cwchar> #include <iostream> #include <sstream> int main() { std::istringstream s("test"); std::mbstate_t st = s.tellg().state(); if (std::mbsinit (&st)) std::cout << "The stream is in the initial shift state\n"; }
Output:
The stream is in the initial shift state
[edit] Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior | 
|---|---|---|---|
| LWG 441 | C++98 | overload (1) was not declared const (it is const in the synopsis) | added const |