+2018-06-14 Jonathan Wakely <jwakely@redhat.com>
+
+ P0935R0 Eradicating unnecessarily explicit default constructors
+ * include/bits/random.h (uniform_real_distribution::param_type)
+ (normal_distribution::param_type, lognormal_distribution::param_type)
+ (gamma_distribution::param_type, chi_squared_distribution::param_type)
+ (cauchy_distribution::param_type, fisher_f_distribution::param_type)
+ (student_t_distribution::param_type)
+ (bernoulli_distribution::param_type)
+ (binomial_distribution::param_type)
+ (geometric_distribution::param_type)
+ (negative_binomial_distribution::param_type)
+ (poisson_distribution::param_type)
+ (exponential_distribution::param_type)
+ (weibull_distribution::param_type)
+ (extreme_value_distribution::param_type): Add non-explicit default
+ constructors. Remove default argument for first parameter of explicit
+ constructors.
+ * include/bits/uniform_int_dist.h
+ (uniform_int_distribution::param_type): Likewise.
+ * include/ext/random
+ (beta_distribution::param_type, rice_distribution::param_type)
+ (nakagami_distribution::param_type, pareto_distribution::param_type)
+ (k_distribution::param_type, arcsine_distribution::param_type)
+ (hoyt_distribution::param_type, triangular_distribution::param_type)
+ (von_mises_distribution::param_type)
+ (hypergeometric_distribution::param_type)
+ (logistic_distribution::param_type)
+ (uniform_inside_sphere_distribution::param_type): Likewise.
+ (uniform_on_sphere_distribution::param_type): Make default constructor
+ non-explicit.
+ * testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc:
+ Test param_type for non-explicit default constructor.
+ * 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.
+
2018-06-14 Daniel Trebbien <dtrebbien@gmail.com>
Jonathan Wakely <jwakely@redhat.com>
{
typedef uniform_real_distribution<_RealType> distribution_type;
+ param_type() : param_type(0) { }
+
explicit
- param_type(_RealType __a = _RealType(0),
- _RealType __b = _RealType(1))
+ param_type(_RealType __a, _RealType __b = _RealType(1))
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_a <= _M_b);
{
typedef normal_distribution<_RealType> distribution_type;
+ param_type() : param_type(0.0) { }
+
explicit
- param_type(_RealType __mean = _RealType(0),
- _RealType __stddev = _RealType(1))
+ param_type(_RealType __mean, _RealType __stddev = _RealType(1))
: _M_mean(__mean), _M_stddev(__stddev)
{
__glibcxx_assert(_M_stddev > _RealType(0));
{
typedef lognormal_distribution<_RealType> distribution_type;
+ param_type() : param_type(0.0) { }
+
explicit
- param_type(_RealType __m = _RealType(0),
- _RealType __s = _RealType(1))
+ param_type(_RealType __m, _RealType __s = _RealType(1))
: _M_m(__m), _M_s(__s)
{ }
typedef gamma_distribution<_RealType> distribution_type;
friend class gamma_distribution<_RealType>;
+ param_type() : param_type(1.0) { }
+
explicit
- param_type(_RealType __alpha_val = _RealType(1),
- _RealType __beta_val = _RealType(1))
+ param_type(_RealType __alpha_val, _RealType __beta_val = _RealType(1))
: _M_alpha(__alpha_val), _M_beta(__beta_val)
{
__glibcxx_assert(_M_alpha > _RealType(0));
{
typedef chi_squared_distribution<_RealType> distribution_type;
+ param_type() : param_type(1) { }
+
explicit
- param_type(_RealType __n = _RealType(1))
+ param_type(_RealType __n)
: _M_n(__n)
{ }
{
typedef cauchy_distribution<_RealType> distribution_type;
+ param_type() : param_type(0) { }
+
explicit
- param_type(_RealType __a = _RealType(0),
- _RealType __b = _RealType(1))
+ param_type(_RealType __a, _RealType __b = _RealType(1))
: _M_a(__a), _M_b(__b)
{ }
{
typedef fisher_f_distribution<_RealType> distribution_type;
+ param_type() : param_type(1) { }
+
explicit
- param_type(_RealType __m = _RealType(1),
- _RealType __n = _RealType(1))
+ param_type(_RealType __m, _RealType __n = _RealType(1))
: _M_m(__m), _M_n(__n)
{ }
{
typedef student_t_distribution<_RealType> distribution_type;
+ param_type() : param_type(1) { }
+
explicit
- param_type(_RealType __n = _RealType(1))
+ param_type(_RealType __n)
: _M_n(__n)
{ }
{
typedef bernoulli_distribution distribution_type;
+ param_type() : param_type(0.5) { }
+
explicit
- param_type(double __p = 0.5)
+ param_type(double __p)
: _M_p(__p)
{
__glibcxx_assert((_M_p >= 0.0) && (_M_p <= 1.0));
typedef binomial_distribution<_IntType> distribution_type;
friend class binomial_distribution<_IntType>;
+ param_type() : param_type(1) { }
+
explicit
- param_type(_IntType __t = _IntType(1), double __p = 0.5)
+ param_type(_IntType __t, double __p = 0.5)
: _M_t(__t), _M_p(__p)
{
__glibcxx_assert((_M_t >= _IntType(0))
typedef geometric_distribution<_IntType> distribution_type;
friend class geometric_distribution<_IntType>;
+ param_type() : param_type(0.5) { }
+
explicit
- param_type(double __p = 0.5)
+ param_type(double __p)
: _M_p(__p)
{
__glibcxx_assert((_M_p > 0.0) && (_M_p < 1.0));
{
typedef negative_binomial_distribution<_IntType> distribution_type;
+ param_type() : param_type(1) { }
+
explicit
- param_type(_IntType __k = 1, double __p = 0.5)
+ param_type(_IntType __k, double __p = 0.5)
: _M_k(__k), _M_p(__p)
{
__glibcxx_assert((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
typedef poisson_distribution<_IntType> distribution_type;
friend class poisson_distribution<_IntType>;
+ param_type() : param_type(1.0) { }
+
explicit
- param_type(double __mean = 1.0)
+ param_type(double __mean)
: _M_mean(__mean)
{
__glibcxx_assert(_M_mean > 0.0);
{
typedef exponential_distribution<_RealType> distribution_type;
+ param_type() : param_type(1.0) { }
+
explicit
- param_type(_RealType __lambda = _RealType(1))
+ param_type(_RealType __lambda)
: _M_lambda(__lambda)
{
__glibcxx_assert(_M_lambda > _RealType(0));
{
typedef weibull_distribution<_RealType> distribution_type;
+ param_type() : param_type(1.0) { }
+
explicit
- param_type(_RealType __a = _RealType(1),
- _RealType __b = _RealType(1))
+ param_type(_RealType __a, _RealType __b = _RealType(1.0))
: _M_a(__a), _M_b(__b)
{ }
{
typedef extreme_value_distribution<_RealType> distribution_type;
+ param_type() : param_type(0.0) { }
+
explicit
- param_type(_RealType __a = _RealType(0),
- _RealType __b = _RealType(1))
+ param_type(_RealType __a, _RealType __b = _RealType(1.0))
: _M_a(__a), _M_b(__b)
{ }
{
typedef uniform_int_distribution<_IntType> distribution_type;
+ param_type() : param_type(0) { }
+
explicit
- param_type(_IntType __a = 0,
- _IntType __b = std::numeric_limits<_IntType>::max())
+ param_type(_IntType __a,
+ _IntType __b = numeric_limits<_IntType>::max())
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_a <= _M_b);
*/
explicit
uniform_int_distribution(_IntType __a,
- _IntType __b = std::numeric_limits<_IntType>::max())
+ _IntType __b = numeric_limits<_IntType>::max())
: _M_param(__a, __b)
{ }
typedef beta_distribution<_RealType> distribution_type;
friend class beta_distribution<_RealType>;
+ param_type() : param_type(1) { }
+
explicit
- param_type(_RealType __alpha_val = _RealType(1),
- _RealType __beta_val = _RealType(1))
+ param_type(_RealType __alpha_val, _RealType __beta_val = _RealType(1))
: _M_alpha(__alpha_val), _M_beta(__beta_val)
{
__glibcxx_assert(_M_alpha > _RealType(0));
{
typedef rice_distribution<result_type> distribution_type;
- param_type(result_type __nu_val = result_type(0),
+ param_type() : param_type(0) { }
+
+ param_type(result_type __nu_val,
result_type __sigma_val = result_type(1))
: _M_nu(__nu_val), _M_sigma(__sigma_val)
{
{
typedef nakagami_distribution<result_type> distribution_type;
- param_type(result_type __mu_val = result_type(1),
+ param_type() : param_type(1) { }
+
+ param_type(result_type __mu_val,
result_type __omega_val = result_type(1))
: _M_mu(__mu_val), _M_omega(__omega_val)
{
{
typedef pareto_distribution<result_type> distribution_type;
- param_type(result_type __alpha_val = result_type(1),
+ param_type() : param_type(1) { }
+
+ param_type(result_type __alpha_val,
result_type __mu_val = result_type(1))
: _M_alpha(__alpha_val), _M_mu(__mu_val)
{
{
typedef k_distribution<result_type> distribution_type;
- param_type(result_type __lambda_val = result_type(1),
+ param_type() : param_type(1) { }
+
+ param_type(result_type __lambda_val,
result_type __mu_val = result_type(1),
result_type __nu_val = result_type(1))
: _M_lambda(__lambda_val), _M_mu(__mu_val), _M_nu(__nu_val)
{
typedef arcsine_distribution<result_type> distribution_type;
- param_type(result_type __a = result_type(0),
- result_type __b = result_type(1))
+ param_type() : param_type(0) { }
+
+ param_type(result_type __a, result_type __b = result_type(1))
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_a <= _M_b);
{
typedef hoyt_distribution<result_type> distribution_type;
- param_type(result_type __q = result_type(0.5L),
- result_type __omega = result_type(1))
+ param_type() : param_type(0.5) { }
+
+ param_type(result_type __q, result_type __omega = result_type(1))
: _M_q(__q), _M_omega(__omega)
{
__glibcxx_assert(_M_q > result_type(0));
{
friend class triangular_distribution<_RealType>;
+ param_type() : param_type(0) { }
+
explicit
- param_type(_RealType __a = _RealType(0),
+ param_type(_RealType __a,
_RealType __b = _RealType(0.5),
_RealType __c = _RealType(1))
: _M_a(__a), _M_b(__b), _M_c(__c)
{
friend class von_mises_distribution<_RealType>;
+ param_type() : param_type(0) { }
+
explicit
- param_type(_RealType __mu = _RealType(0),
- _RealType __kappa = _RealType(1))
+ param_type(_RealType __mu, _RealType __kappa = _RealType(1))
: _M_mu(__mu), _M_kappa(__kappa)
{
const _RealType __pi = __gnu_cxx::__math_constants<_RealType>::__pi;
typedef hypergeometric_distribution<_UIntType> distribution_type;
friend class hypergeometric_distribution<_UIntType>;
+ param_type() : param_type(10) { }
+
explicit
- param_type(result_type __N = 10, result_type __K = 5,
+ param_type(result_type __N, result_type __K = 5,
result_type __n = 1)
: _M_N{__N}, _M_K{__K}, _M_n{__n}
{
{
typedef logistic_distribution<result_type> distribution_type;
- param_type(result_type __a = result_type(0),
- result_type __b = result_type(1))
+ param_type() : param_type(0) { }
+
+ explicit
+ param_type(result_type __a, result_type __b = result_type(1))
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_b > result_type(0));
/** Parameter type. */
struct param_type
{
- explicit
- param_type()
- { }
+ param_type() { }
friend bool
operator==(const param_type&, const param_type&)
= uniform_inside_sphere_distribution<_Dimen, _RealType>;
friend class uniform_inside_sphere_distribution<_Dimen, _RealType>;
+ param_type() : param_type(1.0) { }
+
explicit
- param_type(_RealType __radius = _RealType(1))
+ param_type(_RealType __radius)
: _M_radius(__radius)
{
__glibcxx_assert(_M_radius > _RealType(0));
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::bernoulli_distribution>();
+ test.operator()<std::bernoulli_distribution::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::binomial_distribution<>>();
+ test.operator()<std::binomial_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::cauchy_distribution<>>();
+ test.operator()<std::cauchy_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::chi_squared_distribution<>>();
+ test.operator()<std::chi_squared_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::discrete_distribution<>>();
+ test.operator()<std::discrete_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::exponential_distribution<>>();
+ test.operator()<std::exponential_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::extreme_value_distribution<>>();
+ test.operator()<std::extreme_value_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::fisher_f_distribution<>>();
+ test.operator()<std::fisher_f_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::gamma_distribution<>>();
+ test.operator()<std::gamma_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::geometric_distribution<>>();
+ test.operator()<std::geometric_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::lognormal_distribution<>>();
+ test.operator()<std::lognormal_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::negative_binomial_distribution<>>();
+ test.operator()<std::negative_binomial_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::normal_distribution<>>();
+ test.operator()<std::normal_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::piecewise_constant_distribution<>>();
+ test.operator()<std::piecewise_constant_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::piecewise_linear_distribution<>>();
+ test.operator()<std::piecewise_linear_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::poisson_distribution<>>();
+ test.operator()<std::poisson_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::student_t_distribution<>>();
+ test.operator()<std::student_t_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::uniform_int_distribution<>>();
+ test.operator()<std::uniform_int_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::uniform_real_distribution<>>();
+ test.operator()<std::uniform_real_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<std::weibull_distribution<>>();
+ test.operator()<std::weibull_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::arcsine_distribution<>>();
+ test.operator()<__gnu_cxx::arcsine_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::beta_distribution<>>();
+ test.operator()<__gnu_cxx::beta_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::hoyt_distribution<>>();
+ test.operator()<__gnu_cxx::hoyt_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::hypergeometric_distribution<>>();
+ test.operator()<__gnu_cxx::hypergeometric_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::k_distribution<>>();
+ test.operator()<__gnu_cxx::k_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::logistic_distribution<>>();
+ test.operator()<__gnu_cxx::logistic_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::nakagami_distribution<>>();
+ test.operator()<__gnu_cxx::nakagami_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::normal_mv_distribution<2>>();
+ test.operator()<__gnu_cxx::normal_mv_distribution<2>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::pareto_distribution<>>();
+ test.operator()<__gnu_cxx::pareto_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::rice_distribution<>>();
+ test.operator()<__gnu_cxx::rice_distribution<>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::triangular_distribution<>>();
+ test.operator()<__gnu_cxx::triangular_distribution<>::param_type>();
}
int main()
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::uniform_inside_sphere_distribution<2>>();
+ test.operator()<__gnu_cxx::uniform_inside_sphere_distribution<2>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::uniform_on_sphere_distribution<2>>();
+ test.operator()<__gnu_cxx::uniform_on_sphere_distribution<2>::param_type>();
}
int
{
__gnu_test::implicitly_default_constructible test;
test.operator()<__gnu_cxx::von_mises_distribution<>>();
+ test.operator()<__gnu_cxx::von_mises_distribution<>::param_type>();
}
int main()