1 // Copyright (C) 2018 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do run { target c++11 } }
19 // { dg-require-cstdint "" }
22 #include <testsuite_hooks.h>
27 using result_type
= unsigned;
32 seed_seq(std::initializer_list
<U
>) { }
34 template<class InputIterator
>
35 seed_seq(InputIterator
, InputIterator
) { }
37 template<class RandomAccessIterator
>
38 void generate(RandomAccessIterator first
, RandomAccessIterator last
)
45 size_t size() const { called
= true; return 1; }
47 template<class OutputIterator
>
48 void param(OutputIterator dest
) const { called
= true; dest
= 42; }
50 // Prevents this type being considered as a seed sequence when
51 // T is convertible to the engine's result_type:
52 operator T() const noexcept
{ return T(); }
58 = std::shuffle_order_engine
60 std::linear_congruential_engine
<uint_fast32_t,16807UL, 0UL, 2147483647UL>,
67 seed_seq
<unsigned> seed
;
69 VERIFY( ! seed
.called
);
77 VERIFY( seed
.called
);
79 static_assert(!std::is_constructible
<engine_type
, const seed_seq
<void>&>(),
80 "Cannot construct from a const seed_seq");