xref: /llvm-project/libcxx/test/std/numerics/rand/rand.util/rand.util.seedseq/iterator.verify.cpp (revision 8b29b84c99ac8140c9820fd34b733bdedf5bb0f5)
1*8b29b84cSArthur O'Dwyer //===----------------------------------------------------------------------===//
2*8b29b84cSArthur O'Dwyer //
3*8b29b84cSArthur O'Dwyer // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*8b29b84cSArthur O'Dwyer // See https://llvm.org/LICENSE.txt for license information.
5*8b29b84cSArthur O'Dwyer // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*8b29b84cSArthur O'Dwyer //
7*8b29b84cSArthur O'Dwyer //===----------------------------------------------------------------------===//
8*8b29b84cSArthur O'Dwyer 
9*8b29b84cSArthur O'Dwyer // <random>
10*8b29b84cSArthur O'Dwyer 
11*8b29b84cSArthur O'Dwyer // class seed_seq;
12*8b29b84cSArthur O'Dwyer 
13*8b29b84cSArthur O'Dwyer // template<class InputIterator>
14*8b29b84cSArthur O'Dwyer //   seed_seq(InputIterator begin, InputIterator end);
15*8b29b84cSArthur O'Dwyer // Mandates: iterator_traits<InputIterator>::value_type is an integer type.
16*8b29b84cSArthur O'Dwyer 
17*8b29b84cSArthur O'Dwyer #include <random>
18*8b29b84cSArthur O'Dwyer 
test()19*8b29b84cSArthur O'Dwyer void test()
20*8b29b84cSArthur O'Dwyer {
21*8b29b84cSArthur O'Dwyer   {
22*8b29b84cSArthur O'Dwyer     bool a[2] = {true, false};
23*8b29b84cSArthur O'Dwyer     std::seed_seq s(a, a+2); // OK
24*8b29b84cSArthur O'Dwyer   }
25*8b29b84cSArthur O'Dwyer   {
26*8b29b84cSArthur O'Dwyer     double a[2] = {1, 2};
27*8b29b84cSArthur O'Dwyer     std::seed_seq s(a, a+2); // expected-error@*:* {{Mandates: iterator_traits<InputIterator>::value_type is an integer type}}
28*8b29b84cSArthur O'Dwyer         // expected-error@*:* {{invalid operands to binary expression ('double' and 'unsigned int')}}
29*8b29b84cSArthur O'Dwyer   }
30*8b29b84cSArthur O'Dwyer }
31