| 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) |
e to os with fmtflags set to std::ios_base::dec | std::ios_base::left and the fill character set to the space character.os's original fmtflags and fill character are restored.is (denoted as text) with fmtflags set to std::ios_base::dec, and sets the state of e to that state.is's original fmtflags is restored.
- If
textwas not previously written using an output streampr, the behavior is undefined. - Otherwise, if any of the following values is
false, the behavior is undefined:
-
is.getloc() == pr.getloc() -
std::is_same<decltype(is)::char_type,
decltype(pr)::char_type>::value -
std::is_same<decltype(is)::traits_type,
decltype(pr)::traits_type>::value
-
- Otherwise, if
textis not a valid textual representation of any state of decltype(e), the state ofeis unchanged andis.setstate(std::ios_base::failbit)is called. - Otherwise, given another engine
engof the same type ase. Iftextwas previously written bypr << engand there is no intervening invocations ofeor ofengbetweenpr << engandis >> e,e == engistrue.
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.
Parameters
| os | - | output stream to insert the data to |
| is | - | input stream to extract the data from |
| e | - | pseudo-random number engine |
Return value
osisComplexity
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 |
Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.