operator<<,>>(std::linear_congruential_engine) - cppreference.com (original) (raw)

template< class CharT, class Traits > friend std::basic_ostream<CharT, Traits>& operator<<( std::basic_ostream<CharT, Traits>& os, const linear_congruential_engine& e ); (1) (since C++11)
template< class CharT, class Traits > friend std::basic_istream<CharT, Traits>& operator>>( std::basic_istream<CharT, Traits>& is, linear_congruential_engine& e ); (2) (since C++11)
  1. Writes the textual representation of the current state of e to os with fmtflags set to std::ios_base::dec | std::ios_base::left and the fill character set to the space character.

After writing, os's original fmtflags and fill character are restored.

  1. Reads a textual representation of engine state from is (denoted as text) with fmtflags set to std::ios_base::dec, and sets the state of e to that state.

After reading, is's original fmtflags is restored.

These function templates are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when decltype(e) is an associated class of the arguments.

[edit] Parameters

os - output stream to insert the data to
is - input stream to extract the data from
e - pseudo-random number engine

[edit] Return value

  1. os

  2. is

[edit] Complexity

1,2) Constant.

[edit] Exceptions

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 3519 C++11 the form of insertion and extraction operators were unspecified specified to be hidden friends