名稱空間
變體
操作

std::seed_seq::param

來自 cppreference.com
< cpp‎ | numeric‎ | random‎ | seed_seq
 
 
 
 
 
template< class OutputIt >
void param( OutputIt dest ) const;
(C++11 起)

將儲存的種子複製到以 dest 開頭的範圍。等價於 std::copy(v .begin(), v .end(), dest);

如果 result_type 型別的值不能 寫入 dest,則程式格式錯誤。

如果 OutputIt 不滿足 LegacyOutputIterator 的要求,則行為未定義。

目錄

[編輯] 引數

dest - 輸出範圍的起始迭代器

[編輯] 異常

只丟擲由 dest 上的操作丟擲的異常。

[編輯] 示例

#include <iostream>
#include <iterator>
#include <random>
 
int main()
{
    std::seed_seq s1 = {-1, 0, 1};
    s1.param(std::ostream_iterator<int>(std::cout, " "));
}

輸出

-1 0 1

[編輯] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 釋出時的行為 正確的行為
LWG 2180 C++11 seed_seq::param 不丟擲異常 它可能丟擲異常