Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      operator<<,>>(std::philox_engine)

      From cppreference.com
      <cpp‎ |numeric‎ |random‎ |philox engine

      [edit template]
       
       
       
      Pseudo-random number generation
       
       
      template<class CharT,class Traits>

      friendstd::basic_ostream<CharT, Traits>&
          operator<<(std::basic_ostream<CharT, Traits>& os,

                     const philox_engine& e);
      (1)(since C++26)
      template<class CharT,class Traits>

      friendstd::basic_istream<CharT, Traits>&
          operator>>(std::basic_istream<CharT, Traits>& is,

                      philox_engine& e);
      (2)(since C++26)
      1) Writes the textual representation of the current state ofe toos with fmtflags set tostd::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.
      2) Reads a textual representation of engine state fromis (denoted astext) with fmtflags set tostd::ios_base::dec, and sets the state ofe to that state.
      After reading,is's original fmtflags is restored.
      • Iftext was not previously written using an output streampr, the behavior is undefined.
      • Otherwise, if any of the following values isfalse, 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, iftext is not a valid textual representation of any state ofdecltype(e), the state ofe is unchanged andis.setstate(std::ios_base::failbit) is called.
      • Otherwise, given another engineeng of the same type ase. Iftext was previously written bypr<< eng and there is no intervening invocations ofe or ofeng betweenpr<< eng andis>> e,e== eng istrue.

      These function templates are not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup whendecltype(e) is an associated class of the arguments.

      Contents

      [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)\(\scriptsize O(n) \)O(n).

      [edit]Exceptions

      2) May throwstd::ios_base::failure when settingstd::ios_base::failbit.
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/random/philox_engine/operator_ltltgtgt&oldid=175503"

      [8]ページ先頭

      ©2009-2025 Movatter.jp