Implemented some adaptor constructors which I had missed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@104946 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/random b/include/random
index f3e6656..86663af 100644
--- a/include/random
+++ b/include/random
@@ -1834,7 +1834,8 @@
// constructors and seeding functions
explicit linear_congruential_engine(result_type __s = default_seed)
{seed(__s);}
- template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q)
+ template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q,
+ typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
{seed(__q);}
void seed(result_type __s = default_seed)
{seed(integral_constant<bool, __m == 0>(),
@@ -2073,7 +2074,8 @@
// constructors and seeding functions
explicit mersenne_twister_engine(result_type __sd = default_seed)
{seed(__sd);}
- template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q)
+ template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q,
+ typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
{seed(__q);}
void seed(result_type __sd = default_seed);
template<class _Sseq>
@@ -2431,7 +2433,8 @@
// constructors and seeding functions
explicit subtract_with_carry_engine(result_type __sd = default_seed)
{seed(__sd);}
- template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q)
+ template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q,
+ typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
{seed(__q);}
void seed(result_type __sd = default_seed)
{seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
@@ -2680,14 +2683,26 @@
// constructors and seeding functions
discard_block_engine() : __n_(0) {}
-// explicit discard_block_engine(const _Engine& __e);
-// explicit discard_block_engine(_Engine&& __e);
+ explicit discard_block_engine(const _Engine& __e)
+ : __e_(__e), __n_(0) {}
+#ifdef _LIBCPP_MOVE
+ explicit discard_block_engine(_Engine&& __e)
+ : __e_(_STD::move(__e)), __n_(0) {}
+#endif
explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
- template<class _Sseq> explicit discard_block_engine(_Sseq& __q)
+ template<class _Sseq> explicit discard_block_engine(_Sseq& __q,
+ typename enable_if<!is_convertible<_Sseq, result_type>::value &&
+ !is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q), __n_(0) {}
void seed() {__e_.seed(); __n_ = 0;}
void seed(result_type __sd) {__e_.seed(__sd); __n_ = 0;}
- template<class _Sseq> void seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
+ template<class _Sseq>
+ typename enable_if
+ <
+ !is_convertible<_Sseq, result_type>::value,
+ void
+ >::type
+ seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
// generating functions
result_type operator()();
@@ -2855,14 +2870,26 @@
// constructors and seeding functions
independent_bits_engine() {}
-// explicit independent_bits_engine(const _Engine& __e);
-// explicit independent_bits_engine(_Engine&& __e);
+ explicit independent_bits_engine(const _Engine& __e)
+ : __e_(__e) {}
+#ifdef _LIBCPP_MOVE
+ explicit independent_bits_engine(_Engine&& __e)
+ : __e_(_STD::move(__e)) {}
+#endif
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
- template<class _Sseq> explicit independent_bits_engine(_Sseq& __q)
+ template<class _Sseq> explicit independent_bits_engine(_Sseq& __q,
+ typename enable_if<!is_convertible<_Sseq, result_type>::value &&
+ !is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {}
void seed() {__e_.seed();}
void seed(result_type __sd) {__e_.seed(__sd);}
- template<class _Sseq> void seed(_Sseq& __q) {__e_.seed(__q);}
+ template<class _Sseq>
+ typename enable_if
+ <
+ !is_convertible<_Sseq, result_type>::value,
+ void
+ >::type
+ seed(_Sseq& __q) {__e_.seed(__q);}
// generating functions
result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}
@@ -3051,14 +3078,26 @@
// constructors and seeding functions
shuffle_order_engine() {__init();}
-// explicit shuffle_order_engine(const _Engine& __e);
-// explicit shuffle_order_engine(_Engine&& e);
+ explicit shuffle_order_engine(const _Engine& __e)
+ : __e_(__e) {__init();}
+#ifdef _LIBCPP_MOVE
+ explicit shuffle_order_engine(_Engine&& __e)
+ : __e_(_STD::move(__e)) {__init();}
+#endif
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
- template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q)
+ template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q,
+ typename enable_if<!is_convertible<_Sseq, result_type>::value &&
+ !is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {__init();}
void seed() {__e_.seed(); __init();}
void seed(result_type __sd) {__e_.seed(__sd); __init();}
- template<class _Sseq> void seed(_Sseq& __q) {__e_.seed(__q); __init();}
+ template<class _Sseq>
+ typename enable_if
+ <
+ !is_convertible<_Sseq, result_type>::value,
+ void
+ >::type
+ seed(_Sseq& __q) {__e_.seed(__q); __init();}
// generating functions
result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}