From dd9db6f897cbe85f830a5606435afe51961dbda8 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 12 Jun 2018 20:10:55 +0100 Subject: [PATCH] P0935R0 Eradicating unnecessarily explicit default constructors Explicit default constructors are problematic, so this change removes them from and , as per P0935R0. * include/bits/random.h (linear_congruential_engine) (mersenne_twister_engine, subtract_with_carry_engine, random_device) (uniform_real_distribution, normal_distribution) (lognormal_distribution, gamma_distribution, chi_squared_distribution) (cauchy_distribution, fisher_f_distribution, student_t_distribution) (bernoulli_distribution, binomial_distribution,geometric_distribution) (negative_binomial_distribution, exponential_distribution) (weibull_distribution, extreme_value_distribution): Add non-explicit default constructors. Remove default argument for first parameter of explicit constructors. (piecewise_constant_distribution, piecewise_linear_distribution): Make default constructor non-explicit. * include/bits/uniform_int_dist.h (uniform_int_distribution): Add non-explicit default constructors. Remove default argument for first parameter of explicit constructor. (simd_fast_mersenne_twister_engine, beta_distribution) (rice_distribution, nakagami_distribution, pareto_distribution) (k_distribution, arcsine_distribution, hoyt_distribution) (triangular_distribution, von_mises_distribution) (hypergeometric_distribution, logistic_distribution) (uniform_inside_sphere_distribution): Likewise. (uniform_on_sphere_distribution): Make default constructor non-explicit. * testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc: Test for non-explicit default constructor. Fix references to standard. * testsuite/26_numerics/random/binomial_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/cauchy_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/discrete_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/exponential_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/gamma_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/geometric_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/lognormal_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/normal_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/poisson_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/student_t_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/weibull_distribution/cons/default.cc: Likewise. * testsuite/ext/random/arcsine_distribution/cons/default.cc: Likewise. * testsuite/ext/random/beta_distribution/cons/default.cc: Likewise. * testsuite/ext/random/hoyt_distribution/cons/default.cc: Likewise. * testsuite/ext/random/hypergeometric_distribution/cons/default.cc: Likewise. * testsuite/ext/random/k_distribution/cons/default.cc: Likewise. * testsuite/ext/random/logistic_distribution/cons/default.cc: Likewise. * testsuite/ext/random/nakagami_distribution/cons/default.cc: Likewise. * testsuite/ext/random/normal_mv_distribution/cons/default.cc: Likewise. * testsuite/ext/random/pareto_distribution/cons/default.cc: Likewise. * testsuite/ext/random/rice_distribution/cons/default.cc: Likewise. * testsuite/ext/random/triangular_distribution/cons/default.cc: Likewise. * testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc: Likewise. * testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc: Likewise. * testsuite/ext/random/von_mises_distribution/cons/default.cc: Likewise. * testsuite/util/testsuite_common_types.h (implicitly_default_constructible): New helper. From-SVN: r261522 --- libstdc++-v3/ChangeLog | 89 ++++++++++++ libstdc++-v3/include/bits/random.h | 130 ++++++++++++------ libstdc++-v3/include/bits/uniform_int_dist.h | 7 +- libstdc++-v3/include/ext/random | 98 ++++++++++--- .../bernoulli_distribution/cons/default.cc | 15 +- .../binomial_distribution/cons/default.cc | 15 +- .../cauchy_distribution/cons/default.cc | 15 +- .../chi_squared_distribution/cons/default.cc | 15 +- .../discrete_distribution/cons/default.cc | 15 +- .../exponential_distribution/cons/default.cc | 15 +- .../cons/default.cc | 15 +- .../fisher_f_distribution/cons/default.cc | 15 +- .../random/gamma_distribution/cons/default.cc | 15 +- .../geometric_distribution/cons/default.cc | 18 ++- .../lognormal_distribution/cons/default.cc | 18 ++- .../cons/default.cc | 18 ++- .../normal_distribution/cons/default.cc | 18 ++- .../cons/default.cc | 18 ++- .../cons/default.cc | 18 ++- .../poisson_distribution/cons/default.cc | 18 ++- .../student_t_distribution/cons/default.cc | 18 ++- .../uniform_int_distribution/cons/default.cc | 18 ++- .../uniform_real_distribution/cons/default.cc | 18 ++- .../weibull_distribution/cons/default.cc | 18 ++- .../arcsine_distribution/cons/default.cc | 10 +- .../random/beta_distribution/cons/default.cc | 10 +- .../random/hoyt_distribution/cons/default.cc | 10 +- .../cons/default.cc | 10 +- .../ext/random/k_distribution/cons/default.cc | 10 +- .../logistic_distribution/cons/default.cc | 10 +- .../nakagami_distribution/cons/default.cc | 10 +- .../normal_mv_distribution/cons/default.cc | 10 +- .../pareto_distribution/cons/default.cc | 10 +- .../random/rice_distribution/cons/default.cc | 10 +- .../triangular_distribution/cons/default.cc | 10 +- .../cons/default.cc | 10 +- .../cons/default.cc | 10 +- .../von_mises_distribution/cons/default.cc | 10 +- .../testsuite/util/testsuite_common_types.h | 20 +++ 39 files changed, 671 insertions(+), 146 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 84bc4a79622..368a91ebf33 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,92 @@ +2018-06-12 Jonathan Wakely + + P0935R0 Eradicating unnecessarily explicit default constructors + * include/bits/random.h (linear_congruential_engine) + (mersenne_twister_engine, subtract_with_carry_engine, random_device) + (uniform_real_distribution, normal_distribution) + (lognormal_distribution, gamma_distribution, chi_squared_distribution) + (cauchy_distribution, fisher_f_distribution, student_t_distribution) + (bernoulli_distribution, binomial_distribution,geometric_distribution) + (negative_binomial_distribution, exponential_distribution) + (weibull_distribution, extreme_value_distribution): Add non-explicit + default constructors. Remove default argument for first parameter of + explicit constructors. + (piecewise_constant_distribution, piecewise_linear_distribution): + Make default constructor non-explicit. + * include/bits/uniform_int_dist.h (uniform_int_distribution): Add + non-explicit default constructors. Remove default argument for first + parameter of explicit constructor. + (simd_fast_mersenne_twister_engine, beta_distribution) + (rice_distribution, nakagami_distribution, pareto_distribution) + (k_distribution, arcsine_distribution, hoyt_distribution) + (triangular_distribution, von_mises_distribution) + (hypergeometric_distribution, logistic_distribution) + (uniform_inside_sphere_distribution): Likewise. + (uniform_on_sphere_distribution): Make default constructor + non-explicit. + * testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc: + Test for non-explicit default constructor. Fix references to standard. + * testsuite/26_numerics/random/binomial_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/cauchy_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/discrete_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/exponential_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/gamma_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/geometric_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/lognormal_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/normal_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/poisson_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/student_t_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/weibull_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/arcsine_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/beta_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/hoyt_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/hypergeometric_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/k_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/logistic_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/nakagami_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/normal_mv_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/pareto_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/rice_distribution/cons/default.cc: Likewise. + * testsuite/ext/random/triangular_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/von_mises_distribution/cons/default.cc: + Likewise. + * testsuite/util/testsuite_common_types.h + (implicitly_default_constructible): New helper. + 2018-06-08 Jonathan Wakely * include/bits/ios_base.h (ios::Init::Init(const Init&)) diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index b76cfbb558e..252b14d6d11 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -264,6 +264,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static constexpr result_type modulus = __m; static constexpr result_type default_seed = 1u; + /** + * @brief Constructs a %linear_congruential_engine random number + * generator engine with seed 1. + */ + linear_congruential_engine() : linear_congruential_engine(default_seed) + { } + /** * @brief Constructs a %linear_congruential_engine random number * generator engine with seed @p __s. The default seed value @@ -272,7 +279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @param __s The initial seed value. */ explicit - linear_congruential_engine(result_type __s = default_seed) + linear_congruential_engine(result_type __s) { seed(__s); } /** @@ -504,9 +511,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static constexpr result_type initialization_multiplier = __f; static constexpr result_type default_seed = 5489u; - // constructors and member function + // constructors and member functions + + mersenne_twister_engine() : mersenne_twister_engine(default_seed) { } + explicit - mersenne_twister_engine(result_type __sd = default_seed) + mersenne_twister_engine(result_type __sd) { seed(__sd); } /** @@ -691,12 +701,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static constexpr size_t long_lag = __r; static constexpr result_type default_seed = 19780503u; + subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) + { } + /** - * @brief Constructs an explicitly seeded % subtract_with_carry_engine + * @brief Constructs an explicitly seeded %subtract_with_carry_engine * random number generator. */ explicit - subtract_with_carry_engine(result_type __sd = default_seed) + subtract_with_carry_engine(result_type __sd) { seed(__sd); } /** @@ -1590,24 +1603,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // constructors, destructors and member functions #ifdef _GLIBCXX_USE_RANDOM_TR1 + random_device() { _M_init("default"); } explicit - random_device(const std::string& __token = "default") - { - _M_init(__token); - } + random_device(const std::string& __token) { _M_init(__token); } ~random_device() { _M_fini(); } - #else + random_device() { _M_init("mt19937"); } explicit random_device(const std::string& __token = "mt19937") { _M_init_pretr1(__token); } - - public: - #endif static constexpr result_type @@ -1767,6 +1775,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + /** + * @brief Constructs a uniform_real_distribution object. + * + * The lower bound is set to 0.0 and the upper bound to 1.0 + */ + uniform_real_distribution() : uniform_real_distribution(0.0) { } + /** * @brief Constructs a uniform_real_distribution object. * @@ -1774,8 +1789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @param __b [IN] The upper bound of the distribution. */ explicit - uniform_real_distribution(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) + uniform_real_distribution(_RealType __a, _RealType __b = _RealType(1)) : _M_param(__a, __b) { } @@ -1991,12 +2005,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + normal_distribution() : normal_distribution(0.0) { } + /** * Constructs a normal distribution with parameters @f$mean@f$ and * standard deviation. */ explicit - normal_distribution(result_type __mean = result_type(0), + normal_distribution(result_type __mean, result_type __stddev = result_type(1)) : _M_param(__mean, __stddev), _M_saved_available(false) { } @@ -2205,9 +2221,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_s; }; + lognormal_distribution() : lognormal_distribution(0.0) { } + explicit - lognormal_distribution(_RealType __m = _RealType(0), - _RealType __s = _RealType(1)) + lognormal_distribution(_RealType __m, _RealType __s = _RealType(1)) : _M_param(__m, __s), _M_nd() { } @@ -2425,12 +2442,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + /** + * @brief Constructs a gamma distribution with parameters 1 and 1. + */ + gamma_distribution() : gamma_distribution(1.0) { } + /** * @brief Constructs a gamma distribution with parameters * @f$\alpha@f$ and @f$\beta@f$. */ explicit - gamma_distribution(_RealType __alpha_val = _RealType(1), + gamma_distribution(_RealType __alpha_val, _RealType __beta_val = _RealType(1)) : _M_param(__alpha_val, __beta_val), _M_nd() { } @@ -2630,8 +2652,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_n; }; + chi_squared_distribution() : chi_squared_distribution(1) { } + explicit - chi_squared_distribution(_RealType __n = _RealType(1)) + chi_squared_distribution(_RealType __n) : _M_param(__n), _M_gd(__n / 2) { } @@ -2856,9 +2880,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_b; }; + cauchy_distribution() : cauchy_distribution(0.0) { } + explicit - cauchy_distribution(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) + cauchy_distribution(_RealType __a, _RealType __b = 1.0) : _M_param(__a, __b) { } @@ -3062,8 +3087,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_n; }; + fisher_f_distribution() : fisher_f_distribution(1.0) { } + explicit - fisher_f_distribution(_RealType __m = _RealType(1), + fisher_f_distribution(_RealType __m, _RealType __n = _RealType(1)) : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2) { } @@ -3285,8 +3312,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_n; }; + student_t_distribution() : student_t_distribution(1.0) { } + explicit - student_t_distribution(_RealType __n = _RealType(1)) + student_t_distribution(_RealType __n) : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2) { } @@ -3508,6 +3537,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + /** + * @brief Constructs a Bernoulli distribution with likelihood 0.5. + */ + bernoulli_distribution() : bernoulli_distribution(0.5) { } + /** * @brief Constructs a Bernoulli distribution with likelihood @p p. * @@ -3515,7 +3549,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * Must be in the interval @f$[0, 1]@f$. */ explicit - bernoulli_distribution(double __p = 0.5) + bernoulli_distribution(double __p) : _M_param(__p) { } @@ -3739,10 +3773,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_easy; }; - // constructors and member function + // constructors and member functions + + binomial_distribution() : binomial_distribution(1) { } + explicit - binomial_distribution(_IntType __t = _IntType(1), - double __p = 0.5) + binomial_distribution(_IntType __t, double __p = 0.5) : _M_param(__t, __p), _M_nd() { } @@ -3964,9 +4000,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION double _M_log_1_p; }; - // constructors and member function + // constructors and member functions + + geometric_distribution() : geometric_distribution(0.5) { } + explicit - geometric_distribution(double __p = 0.5) + geometric_distribution(double __p) : _M_param(__p) { } @@ -4166,8 +4205,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION double _M_p; }; + negative_binomial_distribution() : negative_binomial_distribution(1) { } + explicit - negative_binomial_distribution(_IntType __k = 1, double __p = 0.5) + negative_binomial_distribution(_IntType __k, double __p = 0.5) : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p) { } @@ -4399,9 +4440,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif }; - // constructors and member function + // constructors and member functions + + poisson_distribution() : poisson_distribution(1.0) { } + explicit - poisson_distribution(double __mean = 1.0) + poisson_distribution(double __mean) : _M_param(__mean), _M_nd() { } @@ -4610,12 +4654,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + /** + * @brief Constructs an exponential distribution with inverse scale + * parameter 1.0 + */ + exponential_distribution() : exponential_distribution(1.0) { } + /** * @brief Constructs an exponential distribution with inverse scale * parameter @f$\lambda@f$. */ explicit - exponential_distribution(const result_type& __lambda = result_type(1)) + exponential_distribution(_RealType __lambda) : _M_param(__lambda) { } @@ -4820,9 +4870,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_b; }; + weibull_distribution() : weibull_distribution(1.0) { } + explicit - weibull_distribution(_RealType __a = _RealType(1), - _RealType __b = _RealType(1)) + weibull_distribution(_RealType __a, _RealType __b = _RealType(1)) : _M_param(__a, __b) { } @@ -5028,9 +5079,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_b; }; + extreme_value_distribution() : extreme_value_distribution(0.0) { } + explicit - extreme_value_distribution(_RealType __a = _RealType(0), - _RealType __b = _RealType(1)) + extreme_value_distribution(_RealType __a, _RealType __b = _RealType(1)) : _M_param(__a, __b) { } @@ -5496,7 +5548,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::vector _M_cp; }; - explicit piecewise_constant_distribution() : _M_param() { } @@ -5769,7 +5820,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::vector _M_m; }; - explicit piecewise_linear_distribution() : _M_param() { } diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h index 64d4445aa33..3b6d504466d 100644 --- a/libstdc++-v3/include/bits/uniform_int_dist.h +++ b/libstdc++-v3/include/bits/uniform_int_dist.h @@ -98,11 +98,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + /** + * @brief Constructs a uniform distribution object. + */ + uniform_int_distribution() : uniform_int_distribution(0) { } + /** * @brief Constructs a uniform distribution object. */ explicit - uniform_int_distribution(_IntType __a = 0, + uniform_int_distribution(_IntType __a, _IntType __b = std::numeric_limits<_IntType>::max()) : _M_param(__a, __b) { } diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 7e931865af3..3c714f5672c 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -96,9 +96,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION / sizeof(result_type)); static constexpr result_type default_seed = 5489u; - // constructors and member function + // constructors and member functions + + simd_fast_mersenne_twister_engine() + : simd_fast_mersenne_twister_engine(default_seed) + { } + explicit - simd_fast_mersenne_twister_engine(result_type __sd = default_seed) + simd_fast_mersenne_twister_engine(result_type __sd) { seed(__sd); } template> @@ -454,12 +459,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; public: + beta_distribution() : beta_distribution(1.0) { } + /** * @brief Constructs a beta distribution with parameters * @f$\alpha@f$ and @f$\beta@f$. */ explicit - beta_distribution(_RealType __alpha_val = _RealType(1), + beta_distribution(_RealType __alpha_val, _RealType __beta_val = _RealType(1)) : _M_param(__alpha_val, __beta_val) { } @@ -998,9 +1005,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + + rice_distribution() : rice_distribution(0) { } + explicit - rice_distribution(result_type __nu_val = result_type(0), + rice_distribution(result_type __nu_val, result_type __sigma_val = result_type(1)) : _M_param(__nu_val, __sigma_val), _M_ndx(__nu_val, __sigma_val), @@ -1014,6 +1025,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_ndy(result_type(0), __p.sigma()) { } + // @} + /** * @brief Resets the distribution state. */ @@ -1244,9 +1257,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + + nakagami_distribution() : nakagami_distribution(1) { } + explicit - nakagami_distribution(result_type __mu_val = result_type(1), + nakagami_distribution(result_type __mu_val, result_type __omega_val = result_type(1)) : _M_param(__mu_val, __omega_val), _M_gd(__mu_val, __omega_val / __mu_val) @@ -1258,6 +1275,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_gd(__p.mu(), __p.omega() / __p.mu()) { } + // @} + /** * @brief Resets the distribution state. */ @@ -1481,9 +1500,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + + pareto_distribution() : pareto_distribution(1) { } + explicit - pareto_distribution(result_type __alpha_val = result_type(1), + pareto_distribution(result_type __alpha_val, result_type __mu_val = result_type(1)) : _M_param(__alpha_val, __mu_val), _M_ud() @@ -1495,6 +1518,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_ud() { } + // @} + /** * @brief Resets the distribution state. */ @@ -1731,9 +1756,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + + k_distribution() : k_distribution(1) { } + explicit - k_distribution(result_type __lambda_val = result_type(1), + k_distribution(result_type __lambda_val, result_type __mu_val = result_type(1), result_type __nu_val = result_type(1)) : _M_param(__lambda_val, __mu_val, __nu_val), @@ -1748,6 +1777,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_gd2(__p.nu(), __p.mu() / __p.nu()) { } + // @} + /** * @brief Resets the distribution state. */ @@ -1965,10 +1996,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * :{ */ + + arcsine_distribution() : arcsine_distribution(0) { } + explicit - arcsine_distribution(result_type __a = result_type(0), - result_type __b = result_type(1)) + arcsine_distribution(result_type __a, result_type __b = result_type(1)) : _M_param(__a, __b), _M_ud(-1.5707963267948966192313216916397514L, +1.5707963267948966192313216916397514L) @@ -1981,6 +2015,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION +1.5707963267948966192313216916397514L) { } + // @} + /** * @brief Resets the distribution state. */ @@ -2207,10 +2243,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + + hoyt_distribution() : hoyt_distribution(0.5) { } + explicit - hoyt_distribution(result_type __q = result_type(0.5L), - result_type __omega = result_type(1)) + hoyt_distribution(result_type __q, result_type __omega = result_type(1)) : _M_param(__q, __omega), _M_ad(result_type(0.5L) * (result_type(1) + __q * __q), result_type(0.5L) * (result_type(1) + __q * __q) @@ -2459,12 +2498,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_f_bc_ac; }; + triangular_distribution() : triangular_distribution(0.0) { } + /** * @brief Constructs a triangle distribution with parameters * @f$ a @f$, @f$ b @f$ and @f$ c @f$. */ explicit - triangular_distribution(result_type __a = result_type(0), + triangular_distribution(result_type __a, result_type __b = result_type(0.5), result_type __c = result_type(1)) : _M_param(__a, __b, __c) @@ -2668,6 +2709,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: /** The type of the range of the distribution. */ typedef _RealType result_type; + /** Parameter type. */ struct param_type { @@ -2711,14 +2753,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType _M_r; }; + von_mises_distribution() : von_mises_distribution(0.0) { } + /** * @brief Constructs a von Mises distribution with parameters * @f$\mu@f$ and @f$\kappa@f$. */ explicit - von_mises_distribution(result_type __mu = result_type(0), + von_mises_distribution(result_type __mu, result_type __kappa = result_type(1)) - : _M_param(__mu, __kappa) + : _M_param(__mu, __kappa) { } explicit @@ -2956,9 +3000,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type _M_n; }; - // constructors and member function + // constructors and member functions + + hypergeometric_distribution() : hypergeometric_distribution(10) { } + explicit - hypergeometric_distribution(result_type __N = 10, result_type __K = 5, + hypergeometric_distribution(result_type __N, result_type __K = 5, result_type __n = 1) : _M_param{__N, __K, __n} { } @@ -3209,10 +3256,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + logistic_distribution() : logistic_distribution(0.0) { } + explicit - logistic_distribution(result_type __a = result_type(0), - result_type __b = result_type(1)) + logistic_distribution(result_type __a, result_type __b = result_type(1)) : _M_param(__a, __b) { } @@ -3221,6 +3270,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_param(__p) { } + // @} + /** * @brief Resets the distribution state. */ @@ -3401,7 +3452,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructs a uniform on sphere distribution. */ - explicit uniform_on_sphere_distribution() : _M_param(), _M_nd() { } @@ -3609,9 +3659,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Constructors. + * @{ */ + + uniform_inside_sphere_distribution() + : uniform_inside_sphere_distribution(1.0) + { } + explicit - uniform_inside_sphere_distribution(_RealType __radius = _RealType(1)) + uniform_inside_sphere_distribution(_RealType __radius) : _M_param(__radius), _M_uosd() { } @@ -3620,6 +3676,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_param(__p), _M_uosd() { } + // @} + /** * @brief Resets the distribution state. */ diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc index 46c5af0f2a4..42096c0fd34 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.3.1 Class bernoulli_distribution [rand.dist.bern.bernoulli] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -35,8 +37,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc index 74a7a786064..6cf82f1b86c 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.3.2 Class template binomial_distribution [rand.dist.bern.bin] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,15 @@ test01() VERIFY( u.max() == u.t() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc index 04bc15c5182..c1c71ce2ce7 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.4.4 Class template cauchy_distribution [rand.dist.norm.cauchy] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.5.4 Class template cauchy_distribution [rand.dist.norm.cauchy] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc index df985c3e653..8ecf7c0ce4a 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.5.3 Class template chi_squared_distribution [rand.dist.norm.chisq] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc index 6a82f46a686..0e837ed1046 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.6.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -35,8 +37,15 @@ test01() VERIFY( probablility[0] == 1.0 ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc index 00b1f003c61..7285bd351a3 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.4.2 Class template exponential_distribution [rand.dist.pois.exp] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc index db3dc19dbe4..f9187fc7586 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.4.5 Class template extreme_value_distribution [rand.dist.pois.extreme] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc index 16c2077b7da..3032adea816 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.5.5 Class template fisher_f_distribution [rand.dist.norm.f] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc index 8274d45d669..84d2bb73502 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.4.3 Class template gamma_distribution [rand.dist.pois.gamma] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,15 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc index 35221f313fe..d16a2f06db2 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geo] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.3.3 Class template geometric_distribution [rand.dist.bern.geo] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc index b6d57737cfa..5512905cf61 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.5.2 Class template lognormal_distribution [rand.dist.norm.lognormal] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc index f6e2f1d7798..32847dfe699 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.2.4 Class template negative_binomial_distribution [rand.dist.bern.negbin] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.3.4 Class template negative_binomial_distribution [rand.dist.bern.negbin] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc index 941927ba0b4..dd3e0d21655 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.5.1 Class template normal_distribution [rand.dist.norm.normal] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc index 40eb9da422d..84507b45ae7 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.5.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.6.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -39,8 +41,16 @@ test01() VERIFY( density[0] == 1.0 ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc index 11fbc2c537e..e439adf2a3f 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.5.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.6.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -40,8 +42,16 @@ test01() VERIFY( density[1] == 1.0 ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc index 71d0ca0f048..c357581785e 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.4.1 Class template poisson_distribution [rand.dist.pois.poisson] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc index 3524a45b9ff..06c7deef094 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.5.6 Class template student_t_distribution [rand.dist.norm.t] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc index ccfbe26f3c0..8774e660e59 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc @@ -20,12 +20,14 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist.uni.int] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.2.1 Class template uniform_int_distribution [rand.dist.uni.int] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include #include +#include void test01() @@ -37,8 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc index 662f8981099..6a47a4dc473 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.1.1 Class template uniform_real_distribution [rand.dist.uni.real] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.2.2 Class template uniform_real_distribution [rand.dist.uni.real] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -36,8 +38,16 @@ test01() VERIFY( u.max() == 1.0 ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc index 369805eaed9..96db58f2ca6 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc @@ -20,11 +20,13 @@ // with this library; see the file COPYING3. If not see // . -// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] +// C++11 +// 26.5.8.4.4 Class template weibull_distribution [rand.dist.pois.weibull] +// 26.5.1.6 random number distribution requirements [rand.req.dist] #include #include +#include void test01() @@ -37,8 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } -int main() +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()>(); +} + +int +main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/arcsine_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/arcsine_distribution/cons/default.cc index 3b6ed697c72..76b5166caf5 100644 --- a/libstdc++-v3/testsuite/ext/random/arcsine_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/arcsine_distribution/cons/default.cc @@ -22,6 +22,7 @@ #include #include +#include void test01() @@ -33,9 +34,16 @@ test01() VERIFY( u.max() == 1.0 ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::arcsine_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/beta_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/beta_distribution/cons/default.cc index 375d6c538b3..9675a557a9a 100644 --- a/libstdc++-v3/testsuite/ext/random/beta_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/beta_distribution/cons/default.cc @@ -23,6 +23,7 @@ #include #include +#include void test01() @@ -34,8 +35,15 @@ test01() VERIFY( u.max() == 1.0 ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::beta_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/hoyt_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/hoyt_distribution/cons/default.cc index c4c9a9c0961..53022345aea 100644 --- a/libstdc++-v3/testsuite/ext/random/hoyt_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/hoyt_distribution/cons/default.cc @@ -22,6 +22,7 @@ #include #include +#include void test01() @@ -34,9 +35,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::hoyt_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc index 659db01dc76..d4078d4df37 100644 --- a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/cons/default.cc @@ -25,6 +25,7 @@ #include #include +#include void test01() @@ -37,9 +38,16 @@ test01() VERIFY( u.max() == 1 ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::hypergeometric_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/k_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/k_distribution/cons/default.cc index 6e06683c26e..cc11ccb2701 100644 --- a/libstdc++-v3/testsuite/ext/random/k_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/k_distribution/cons/default.cc @@ -25,6 +25,7 @@ #include #include +#include void test01() @@ -38,9 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::k_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/logistic_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/logistic_distribution/cons/default.cc index 6d902785402..3d7db75524d 100644 --- a/libstdc++-v3/testsuite/ext/random/logistic_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/logistic_distribution/cons/default.cc @@ -25,6 +25,7 @@ #include #include +#include void test01() @@ -38,9 +39,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::logistic_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/nakagami_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/nakagami_distribution/cons/default.cc index 9bc6e2c41f8..ea473f2fca5 100644 --- a/libstdc++-v3/testsuite/ext/random/nakagami_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/nakagami_distribution/cons/default.cc @@ -25,6 +25,7 @@ #include #include +#include void test01() @@ -37,9 +38,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::nakagami_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc index f691e13022b..c209a8d89dc 100644 --- a/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc @@ -23,6 +23,7 @@ #include #include +#include void test01() @@ -40,8 +41,15 @@ test01() VERIFY( u.max()[1] == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::normal_mv_distribution<2>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/pareto_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/pareto_distribution/cons/default.cc index d320a6be070..368d7da1910 100644 --- a/libstdc++-v3/testsuite/ext/random/pareto_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/pareto_distribution/cons/default.cc @@ -25,6 +25,7 @@ #include #include +#include void test01() @@ -37,9 +38,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::pareto_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/rice_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/rice_distribution/cons/default.cc index 5a3b92787ce..1483f87000a 100644 --- a/libstdc++-v3/testsuite/ext/random/rice_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/rice_distribution/cons/default.cc @@ -25,6 +25,7 @@ #include #include +#include void test01() @@ -37,9 +38,16 @@ test01() VERIFY( u.max() == std::numeric_limits::max() ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::rice_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc index 8f33e3acdef..c7c6aba5936 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc @@ -23,6 +23,7 @@ #include #include +#include void test01() @@ -35,8 +36,15 @@ test01() VERIFY( u.max() == 1.0 ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::triangular_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc index 7a7c04d6455..e15a12d79ae 100644 --- a/libstdc++-v3/testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc @@ -23,6 +23,7 @@ #include #include +#include void test01() @@ -35,9 +36,16 @@ test01() __gnu_cxx::uniform_inside_sphere_distribution<5, float> u5; } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::uniform_inside_sphere_distribution<2>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc index 446893dd122..8aa81b328a2 100644 --- a/libstdc++-v3/testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc @@ -24,6 +24,7 @@ // 26.5.1.6 Random number distribution requirements [rand.req.dist] #include +#include void test01() @@ -34,9 +35,16 @@ test01() __gnu_cxx::uniform_on_sphere_distribution<5, float> u5; } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::uniform_on_sphere_distribution<2>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc index 9ae700257c9..1a4784d49d9 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc @@ -23,6 +23,7 @@ #include #include +#include void test01() @@ -34,8 +35,15 @@ test01() VERIFY( u.max() == __gnu_cxx::__math_constants::__pi ); } +void +test02() +{ + __gnu_test::implicitly_default_constructible test; + test.operator()<__gnu_cxx::von_mises_distribution<>>(); +} + int main() { test01(); - return 0; + test02(); } diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h index 1069a1a997b..2e977b57cf1 100644 --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h @@ -687,6 +687,26 @@ namespace __gnu_test }; #if __cplusplus >= 201103L + // Generator to test non-explicit default constructor. + struct implicitly_default_constructible + { + template + void + operator()() + { + struct _Concept + { + struct Aggregate { _Tp v; }; + + void __constraint() + { Aggregate __v __attribute__((unused)) = { }; } + }; + + void (_Concept::*__x)() __attribute__((unused)) + = &_Concept::__constraint; + } + }; + // Generator to test default constructor. struct constexpr_default_constructible { -- 2.30.2