xref: /llvm-project/libcxx/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp (revision 24e1736d84fd0fb45097245706a523c3398beb69)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <random>
10 
11 // template<class Engine, size_t k>
12 // class shuffle_order_engine
13 
14 // explicit shuffle_order_engine(const Engine& e);
15 
16 #include <random>
17 
18 #include <cassert>
19 #include <utility>
20 
21 #include "test_macros.h"
22 
main(int,char **)23 int main(int, char**)
24 {
25     {
26         typedef std::minstd_rand0 Engine;
27         typedef std::knuth_b Adaptor;
28         Engine e;
29         Engine e0 = e;
30         Adaptor a(std::move(e0));
31         for (unsigned k = 0; k <= Adaptor::table_size; ++k) {
32             (void)e();
33         }
34 
35         assert(a.base() == e);
36     }
37 
38   return 0;
39 }
40