+2018-06-12 Jonathan Wakely <jwakely@redhat.com>
+
+ 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 <jwakely@redhat.com>
* include/bits/ios_base.h (ios::Init::Init(const Init&))
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
* @param __s The initial seed value.
*/
explicit
- linear_congruential_engine(result_type __s = default_seed)
+ linear_congruential_engine(result_type __s)
{ seed(__s); }
/**
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); }
/**
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); }
/**
// 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
};
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.
*
* @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)
{ }
};
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)
{ }
_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()
{ }
};
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()
{ }
_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)
{ }
_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)
{ }
_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)
{ }
_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)
{ }
};
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.
*
* Must be in the interval @f$[0, 1]@f$.
*/
explicit
- bernoulli_distribution(double __p = 0.5)
+ bernoulli_distribution(double __p)
: _M_param(__p)
{ }
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()
{ }
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)
{ }
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)
{ }
#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()
{ }
};
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)
{ }
_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)
{ }
_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)
{ }
std::vector<double> _M_cp;
};
- explicit
piecewise_constant_distribution()
: _M_param()
{ }
std::vector<double> _M_m;
};
- explicit
piecewise_linear_distribution()
: _M_param()
{ }
};
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)
{ }
/ 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<typename _Sseq, typename = _If_seed_seq<_Sseq>>
};
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)
{ }
/**
* @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),
_M_ndy(result_type(0), __p.sigma())
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
/**
* @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)
_M_gd(__p.mu(), __p.omega() / __p.mu())
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
/**
* @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()
_M_ud()
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
/**
* @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),
_M_gd2(__p.nu(), __p.mu() / __p.nu())
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
/**
* @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)
+1.5707963267948966192313216916397514L)
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
/**
* @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)
_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)
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
_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
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}
{ }
/**
* @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)
{ }
: _M_param(__p)
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
/**
* @brief Constructs a uniform on sphere distribution.
*/
- explicit
uniform_on_sphere_distribution()
: _M_param(), _M_nd()
{ }
/**
* @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()
{ }
: _M_param(__p), _M_uosd()
{ }
+ // @}
+
/**
* @brief Resets the distribution state.
*/
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<bool>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::bernoulli_distribution>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == u.t() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::binomial_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::cauchy_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::chi_squared_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( probablility[0] == 1.0 );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::discrete_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::exponential_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::extreme_value_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::fisher_f_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::gamma_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::geometric_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::lognormal_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::negative_binomial_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::normal_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( density[0] == 1.0 );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::piecewise_constant_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( density[1] == 1.0 );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::piecewise_linear_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::poisson_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::student_t_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <limits>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<int>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::uniform_int_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == 1.0 );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::uniform_real_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 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 <random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
-int main()
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<std::weibull_distribution<>>();
+}
+
+int
+main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
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();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
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();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::hoyt_distribution<>>();
+}
+
int
main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
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();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::k_distribution<>>();
+}
+
int
main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::logistic_distribution<>>();
+}
+
int
main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::nakagami_distribution<>>();
+}
+
int
main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max()[1] == std::numeric_limits<result_type::value_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::normal_mv_distribution<2>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::pareto_distribution<>>();
+}
+
int
main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == std::numeric_limits<result_type>::max() );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::rice_distribution<>>();
+}
+
int
main()
{
test01();
- return 0;
+ test02();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
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();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
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();
}
// 26.5.1.6 Random number distribution requirements [rand.req.dist]
#include <ext/random>
+#include <testsuite_common_types.h>
void
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();
}
#include <ext/random>
#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
void
test01()
VERIFY( u.max() == __gnu_cxx::__math_constants<double>::__pi );
}
+void
+test02()
+{
+ __gnu_test::implicitly_default_constructible test;
+ test.operator()<__gnu_cxx::von_mises_distribution<>>();
+}
+
int main()
{
test01();
- return 0;
+ test02();
}
};
#if __cplusplus >= 201103L
+ // Generator to test non-explicit default constructor.
+ struct implicitly_default_constructible
+ {
+ template<typename _Tp>
+ 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
{