aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/random
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-01-20 15:28:48 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2017-01-20 15:28:48 +0000
commit12905f106c1cc8c6757038e3c41df478077bb870 (patch)
tree93ec759f820a9b0cd2a26d566a712a341cf5872a /libstdc++-v3/include/ext/random
parent0a3ec628c1db294a2135ea4fab8a71c121186cfb (diff)
downloadgcc-12905f106c1cc8c6757038e3c41df478077bb870.zip
gcc-12905f106c1cc8c6757038e3c41df478077bb870.tar.gz
gcc-12905f106c1cc8c6757038e3c41df478077bb870.tar.bz2
PR69240 Define inequality operators for <random> param types
PR libstdc++/69240 * 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) (discrete_distribution::param_type) (piecewise_constant_distribution::param_type) (piecewise_linear_distribution::param_type): Define operator!=. * 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_on_sphere_distribution::param_type) (uniform_inside_sphere_distribution::param_type): Likewise. * testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc: Test construction with param_type. * testsuite/26_numerics/random/binomial_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/exponential_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/extreme_value_distribution/cons/ parms.cc: Likewise. * testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/gamma_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/geometric_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/negative_binomial_distribution/cons/ parms.cc: Likewise. * testsuite/26_numerics/random/normal_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/poisson_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/student_t_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/weibull_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/arcsine_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/beta_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/hoyt_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/hypergeometric_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/k_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/logistic_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/nakagami_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/pareto_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/rice_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/triangular_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/uniform_inside_sphere_distribution/cons/ parms.cc: Likewise. * testsuite/ext/random/von_mises_distribution/cons/parms.cc: Likewise. From-SVN: r244722
Diffstat (limited to 'libstdc++-v3/include/ext/random')
-rw-r--r--libstdc++-v3/include/ext/random95
1 files changed, 80 insertions, 15 deletions
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 6a3aaac..d93757b 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -404,6 +404,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -432,6 +433,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return (__p1._M_alpha == __p2._M_alpha
&& __p1._M_beta == __p2._M_beta); }
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
+
private:
void
_M_initialize();
@@ -710,6 +715,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_mean == __p2._M_mean && __p1._M_t == __p2._M_t; }
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
+
private:
template <typename _InputIterator1, typename _InputIterator2>
void _M_init_full(_InputIterator1 __meanbegin,
@@ -942,6 +951,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -965,8 +975,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return __p1._M_nu == __p2._M_nu
- && __p1._M_sigma == __p2._M_sigma; }
+ { return __p1._M_nu == __p2._M_nu && __p1._M_sigma == __p2._M_sigma; }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
void _M_initialize();
@@ -1184,6 +1197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -1207,8 +1221,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return __p1._M_mu == __p2._M_mu
- && __p1._M_omega == __p2._M_omega; }
+ { return __p1._M_mu == __p2._M_mu && __p1._M_omega == __p2._M_omega; }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
void _M_initialize();
@@ -1417,6 +1434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -1442,6 +1460,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_alpha == __p2._M_alpha && __p1._M_mu == __p2._M_mu; }
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
+
private:
void _M_initialize();
@@ -1651,6 +1673,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -1680,9 +1703,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return __p1._M_lambda == __p2._M_lambda
+ {
+ return __p1._M_lambda == __p2._M_lambda
&& __p1._M_mu == __p2._M_mu
- && __p1._M_nu == __p2._M_nu; }
+ && __p1._M_nu == __p2._M_nu;
+ }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
void _M_initialize();
@@ -1890,6 +1919,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -1914,6 +1944,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
+
private:
void _M_initialize();
@@ -2126,6 +2160,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -2149,8 +2184,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return __p1._M_q == __p2._M_q
- && __p1._M_omega == __p2._M_omega; }
+ { return __p1._M_q == __p2._M_q && __p1._M_omega == __p2._M_omega; }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
void _M_initialize();
@@ -2359,6 +2397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -2393,8 +2432,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return (__p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b
- && __p1._M_c == __p2._M_c); }
+ {
+ return (__p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b
+ && __p1._M_c == __p2._M_c);
+ }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
@@ -2646,8 +2691,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return (__p1._M_mu == __p2._M_mu
- && __p1._M_kappa == __p2._M_kappa); }
+ { return __p1._M_mu == __p2._M_mu && __p1._M_kappa == __p2._M_kappa; }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
_RealType _M_mu;
@@ -2889,6 +2937,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& (__p1._M_K == __p2._M_K)
&& (__p1._M_n == __p2._M_n); }
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
+
private:
result_type _M_N;
@@ -3111,6 +3163,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef _RealType result_type;
+
/** Parameter type. */
struct param_type
{
@@ -3133,8 +3186,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const param_type& __p1, const param_type& __p2)
- { return __p1._M_a == __p2._M_a
- && __p1._M_b == __p2._M_b; }
+ { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
private:
void _M_initialize();
@@ -3317,6 +3373,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
/** The type of the range of the distribution. */
typedef std::array<_RealType, _Dimen> result_type;
+
/** Parameter type. */
struct param_type
{
@@ -3325,8 +3382,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ }
friend bool
- operator==(const param_type& __p1, const param_type& __p2)
+ operator==(const param_type&, const param_type&)
{ return true; }
+
+ friend bool
+ operator!=(const param_type&, const param_type&)
+ { return false; }
};
/**
@@ -3530,6 +3591,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_radius == __p2._M_radius; }
+ friend bool
+ operator!=(const param_type& __p1, const param_type& __p2)
+ { return !(__p1 == __p2); }
+
private:
_RealType _M_radius;
};