命名空间
变体
操作

std::seed_seq::param

来自 cppreference.cn
< 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 不抛出异常 它可能抛出异常