[LLVM][NVPTX] Add support for griddepcontrol instruction (#123511)
[llvm-project.git] / libcxx / test / std / numerics / rand / rand.dist / rand.dist.pois / rand.dist.pois.exp / ctor_double.pass.cpp
blob1259a7f79bd4105b78c37c0629be39c4ff6a9916
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 //===----------------------------------------------------------------------===//
9 // <random>
11 // template<class RealType = double>
12 // class exponential_distribution
14 // explicit exponential_distribution(RealType lambda = 1.0); // before C++20
15 // exponential_distribution() : exponential_distribution(1.0) {} // C++20
16 // explicit exponential_distribution(RealType lambda); // C++20
18 #include <random>
19 #include <cassert>
21 #include "test_macros.h"
22 #if TEST_STD_VER >= 11
23 #include "make_implicit.h"
24 #include "test_convertible.h"
25 #endif
27 template <class T>
28 void test_implicit() {
29 #if TEST_STD_VER >= 11
30 typedef std::exponential_distribution<T> D;
31 static_assert(test_convertible<D>(), "");
32 assert(D(1) == make_implicit<D>());
33 static_assert(!test_convertible<D, T>(), "");
34 #endif
37 int main(int, char**)
40 typedef std::exponential_distribution<> D;
41 D d;
42 assert(d.lambda() == 1);
45 typedef std::exponential_distribution<> D;
46 D d(3.5);
47 assert(d.lambda() == 3.5);
50 test_implicit<float>();
51 test_implicit<double>();
53 return 0;