public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4305] libstdc++: Do not define operator!= in <random> for C++20
@ 2022-11-25 15:07 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-11-25 15:07 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:48e4a9d93885b3d82cfcbf1e804fe9c3eaabf157

commit r13-4305-g48e4a9d93885b3d82cfcbf1e804fe9c3eaabf157
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 24 21:16:41 2022 +0000

    libstdc++: Do not define operator!= in <random> for C++20
    
    These overloads are not needed in C++20 as they can be synthesized by
    the compiler. Removing them means less code to compile when including
    these headers.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/random.h [three_way_comparison] (operator!=):
            Do not define inequality operators when C++20 three way
            comparisons are supported.
            * include/ext/random [three_way_comparison] (operator!=):
            Likewise.

Diff:
---
 libstdc++-v3/include/bits/random.h | 106 +++++++++++++++++++++++++++++++------
 libstdc++-v3/include/ext/random    |  72 ++++++++++++++++++++-----
 2 files changed, 148 insertions(+), 30 deletions(-)

diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index 28b37a9e5a5..3b4e7d42bb5 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -423,6 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _UIntType _M_x;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Compares two linear congruential random number generator
    * objects of the same type for inequality.
@@ -441,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const std::linear_congruential_engine<_UIntType, __a,
 	       __c, __m>& __rhs)
     { return !(__lhs == __rhs); }
-
+#endif
 
   /**
    * A generalized feedback shift register discrete random number generator.
@@ -656,6 +657,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       size_t    _M_p;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Compares two % mersenne_twister_engine random number generator
    *        objects of the same type for inequality.
@@ -679,7 +681,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const std::mersenne_twister_engine<_UIntType, __w, __n, __m,
 	       __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs)
     { return !(__lhs == __rhs); }
-
+#endif
 
   /**
    * @brief The Marsaglia-Zaman generator.
@@ -862,6 +864,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       size_t     _M_p;			///< Current index of x(i - r).
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Compares two % subtract_with_carry_engine random number
    *        generator objects of the same type for inequality.
@@ -881,7 +884,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const std::subtract_with_carry_engine<_UIntType, __w,
 	       __s, __r>& __rhs)
     { return !(__lhs == __rhs); }
-
+#endif
 
   /**
    * Produces random numbers from some base engine by discarding blocks of
@@ -1087,6 +1090,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       size_t _M_n;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Compares two %discard_block_engine random number generator
    *        objects of the same type for inequality.
@@ -1105,7 +1109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const std::discard_block_engine<_RandomNumberEngine, __p,
 	       __r>& __rhs)
     { return !(__lhs == __rhs); }
-
+#endif
 
   /**
    * Produces random numbers by combining random numbers from some base
@@ -1284,6 +1288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _RandomNumberEngine _M_b;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Compares two %independent_bits_engine random number generator
    * objects of the same type for inequality.
@@ -1303,6 +1308,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const std::independent_bits_engine<_RandomNumberEngine, __w,
 	       _UIntType>& __rhs)
     { return !(__lhs == __rhs); }
+#endif
 
   /**
    * @brief Inserts the current state of a %independent_bits_engine random
@@ -1541,6 +1547,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       result_type _M_y;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * Compares two %shuffle_order_engine random number generator objects
    * of the same type for inequality.
@@ -1559,7 +1566,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const std::shuffle_order_engine<_RandomNumberEngine,
 	       __k>& __rhs)
     { return !(__lhs == __rhs); }
-
+#endif
 
   /**
    * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.
@@ -1703,6 +1710,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // std::uniform_int_distribution is defined in <bits/uniform_int_dist.h>
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two uniform integer distributions have
    *        different parameters.
@@ -1712,6 +1720,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::uniform_int_distribution<_IntType>& __d1,
 	       const std::uniform_int_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %uniform_int_distribution random number
@@ -1786,9 +1795,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_a;
@@ -1924,6 +1935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two uniform real distributions have
    *        different parameters.
@@ -1933,6 +1945,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::uniform_real_distribution<_IntType>& __d1,
 	       const std::uniform_real_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %uniform_real_distribution random number
@@ -2017,9 +2030,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	{ return (__p1._M_mean == __p2._M_mean
 		  && __p1._M_stddev == __p2._M_stddev); }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_mean;
@@ -2182,6 +2197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       bool        _M_saved_available = false;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two normal distributions are different.
    */
@@ -2190,7 +2206,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::normal_distribution<_RealType>& __d1,
 	       const std::normal_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A lognormal_distribution random number distribution.
@@ -2235,9 +2251,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_m;
@@ -2393,6 +2411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<result_type> _M_nd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two lognormal distributions are different.
    */
@@ -2401,7 +2420,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::lognormal_distribution<_RealType>& __d1,
 	       const std::lognormal_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A gamma continuous distribution for random numbers.
@@ -2451,9 +2470,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	{ return (__p1._M_alpha == __p2._M_alpha
 		  && __p1._M_beta == __p2._M_beta); }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -2624,6 +2645,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<result_type> _M_nd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two gamma distributions are different.
    */
@@ -2632,7 +2654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
      operator!=(const std::gamma_distribution<_RealType>& __d1,
 		const std::gamma_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A chi_squared_distribution random number distribution.
@@ -2670,9 +2692,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_n == __p2._M_n; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_n;
@@ -2848,6 +2872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::gamma_distribution<result_type> _M_gd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Chi-squared distributions are different.
    */
@@ -2856,7 +2881,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::chi_squared_distribution<_RealType>& __d1,
 	       const std::chi_squared_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A cauchy_distribution random number distribution.
@@ -2898,9 +2923,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_a;
@@ -3021,6 +3048,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Cauchy distributions have
    *        different parameters.
@@ -3030,6 +3058,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::cauchy_distribution<_RealType>& __d1,
 	       const std::cauchy_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %cauchy_distribution random number distribution
@@ -3106,9 +3135,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_m;
@@ -3286,6 +3317,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::gamma_distribution<result_type> _M_gd_x, _M_gd_y;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Fisher f distributions are different.
    */
@@ -3294,6 +3326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::fisher_f_distribution<_RealType>& __d1,
 	       const std::fisher_f_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief A student_t_distribution random number distribution.
@@ -3334,9 +3367,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_n == __p2._M_n; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_n;
@@ -3508,6 +3543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::gamma_distribution<result_type> _M_gd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Student t distributions are different.
    */
@@ -3516,7 +3552,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::student_t_distribution<_RealType>& __d1,
 	       const std::student_t_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /// @} group random_distributions_normal
 
@@ -3560,9 +3596,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       operator==(const param_type& __p1, const param_type& __p2)
       { return __p1._M_p == __p2._M_p; }
 
+#if __cpp_impl_three_way_comparison < 201907L
       friend bool
       operator!=(const param_type& __p1, const param_type& __p2)
       { return !(__p1 == __p2); }
+#endif
 
     private:
       double _M_p;
@@ -3696,6 +3734,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     param_type _M_param;
   };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Bernoulli distributions have
    *        different parameters.
@@ -3704,6 +3743,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   operator!=(const std::bernoulli_distribution& __d1,
 	     const std::bernoulli_distribution& __d2)
   { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %bernoulli_distribution random number distribution
@@ -3788,9 +3828,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -3971,6 +4013,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<double> _M_nd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two binomial distributions are different.
    */
@@ -3979,7 +4022,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::binomial_distribution<_IntType>& __d1,
 	       const std::binomial_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A discrete geometric random number distribution.
@@ -4022,9 +4065,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_p == __p2._M_p; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -4149,6 +4194,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two geometric distributions have
    *        different parameters.
@@ -4158,6 +4204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::geometric_distribution<_IntType>& __d1,
 	       const std::geometric_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %geometric_distribution random number distribution
@@ -4234,9 +4281,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_IntType _M_k;
@@ -4404,6 +4453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::gamma_distribution<double> _M_gd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two negative binomial distributions are different.
    */
@@ -4412,7 +4462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::negative_binomial_distribution<_IntType>& __d1,
 	       const std::negative_binomial_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /// @} group random_distributions_bernoulli
 
@@ -4463,9 +4513,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_mean == __p2._M_mean; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	// Hosts either log(mean) or the threshold of the simple method.
@@ -4630,6 +4682,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<double> _M_nd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Poisson distributions are different.
    */
@@ -4638,7 +4691,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::poisson_distribution<_IntType>& __d1,
 	       const std::poisson_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief An exponential continuous distribution for random numbers.
@@ -4687,9 +4740,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_lambda == __p2._M_lambda; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_lambda;
@@ -4820,6 +4875,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two exponential distributions have different
    *        parameters.
@@ -4829,6 +4885,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::exponential_distribution<_RealType>& __d1,
 	       const std::exponential_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %exponential_distribution random number distribution
@@ -4904,9 +4961,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_a;
@@ -5030,6 +5089,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
    /**
     * @brief Return true if two Weibull distributions have different
     *        parameters.
@@ -5039,6 +5099,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::weibull_distribution<_RealType>& __d1,
 	       const std::weibull_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %weibull_distribution random number distribution
@@ -5114,9 +5175,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_a;
@@ -5240,6 +5303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
     * @brief Return true if two extreme value distributions have different
     *        parameters.
@@ -5249,6 +5313,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::extreme_value_distribution<_RealType>& __d1,
 	       const std::extreme_value_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief Inserts a %extreme_value_distribution random number distribution
@@ -5333,9 +5398,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_prob == __p2._M_prob; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -5505,6 +5572,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
     * @brief Return true if two discrete distributions have different
     *        parameters.
@@ -5514,7 +5582,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::discrete_distribution<_IntType>& __d1,
 	       const std::discrete_distribution<_IntType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A piecewise_constant_distribution random number distribution.
@@ -5579,9 +5647,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -5776,6 +5846,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
     * @brief Return true if two piecewise constant distributions have 
     *        different parameters.
@@ -5785,7 +5856,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::piecewise_constant_distribution<_RealType>& __d1,
 	       const std::piecewise_constant_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A piecewise_linear_distribution random number distribution.
@@ -5850,9 +5921,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -6049,6 +6122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
     * @brief Return true if two piecewise linear distributions have
     *        different parameters.
@@ -6058,7 +6132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const std::piecewise_linear_distribution<_RealType>& __d1,
 	       const std::piecewise_linear_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /// @} group random_distributions_poisson
 
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 406b12b5d23..eb7eaf5bc69 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       void _M_period_certification();
   };
 
-
+#if __cpp_impl_three_way_comparison < 201907L
   template<typename _UIntType, size_t __m,
 	   size_t __pos1, size_t __sl1, size_t __sl2,
 	   size_t __sr1, size_t __sr2,
@@ -224,7 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3,
 	       __msk4, __parity1, __parity2, __parity3, __parity4>& __rhs)
     { return !(__lhs == __rhs); }
-
+#endif
 
   /* Definitions for the SIMD-oriented Fast Mersenne Twister as defined
    * in the C implementation by Daito and Matsumoto, as both a 32-bit
@@ -451,9 +451,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	{ return (__p1._M_alpha == __p2._M_alpha
 		  && __p1._M_beta == __p2._M_beta); }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void
@@ -616,6 +618,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two beta distributions are different.
    */
@@ -624,7 +627,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1,
 	       const __gnu_cxx::beta_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A multi-variate normal continuous distribution for random numbers.
@@ -735,9 +738,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	template <typename _InputIterator1, typename _InputIterator2>
@@ -943,6 +948,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<_RealType> _M_nd;
   };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two multi-variate normal distributions are
    * different.
@@ -954,7 +960,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>&
 	       __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A Rice continuous distribution for random numbers.
@@ -1014,9 +1020,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_nu == __p2._M_nu && __p1._M_sigma == __p2._M_sigma; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -1209,6 +1217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<result_type> _M_ndy;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Rice distributions are not equal.
    */
@@ -1217,7 +1226,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const rice_distribution<_RealType1>& __d1,
 	       const rice_distribution<_RealType1>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A Nakagami continuous distribution for random numbers.
@@ -1268,9 +1277,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_mu == __p2._M_mu && __p1._M_omega == __p2._M_omega; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -1442,6 +1453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::gamma_distribution<result_type> _M_gd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Nakagami distributions are not equal.
    */
@@ -1450,7 +1462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const nakagami_distribution<_RealType>& __d1,
 	       const nakagami_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A Pareto continuous distribution for random numbers.
@@ -1513,9 +1525,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -1691,6 +1705,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::uniform_real_distribution<result_type> _M_ud;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Pareto distributions are not equal.
    */
@@ -1699,7 +1714,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const pareto_distribution<_RealType>& __d1,
 	       const pareto_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A K continuous distribution for random numbers.
@@ -1770,9 +1785,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	      && __p1._M_nu == __p2._M_nu;
 	}
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -1950,6 +1967,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::gamma_distribution<result_type> _M_gd2;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two K distributions are not equal.
    */
@@ -1958,7 +1976,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const k_distribution<_RealType>& __d1,
 	       const k_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief An arcsine continuous distribution for random numbers.
@@ -2012,9 +2030,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -2191,6 +2211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::uniform_real_distribution<result_type> _M_ud;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two arcsine distributions are not equal.
    */
@@ -2199,7 +2220,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const arcsine_distribution<_RealType>& __d1,
 	       const arcsine_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A Hoyt continuous distribution for random numbers.
@@ -2260,9 +2281,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_q == __p2._M_q && __p1._M_omega == __p2._M_omega; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -2436,6 +2459,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::exponential_distribution<result_type> _M_ed;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two Hoyt distributions are not equal.
    */
@@ -2444,7 +2468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const hoyt_distribution<_RealType>& __d1,
 	       const hoyt_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A triangular distribution for random numbers.
@@ -2516,9 +2540,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		  && __p1._M_c == __p2._M_c);
 	}
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 
@@ -2700,6 +2726,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two triangle distributions are different.
    */
@@ -2708,7 +2735,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const __gnu_cxx::triangular_distribution<_RealType>& __d1,
 	       const __gnu_cxx::triangular_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A von Mises distribution for random numbers.
@@ -2776,9 +2803,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_mu == __p2._M_mu && __p1._M_kappa == __p2._M_kappa; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_mu;
@@ -2942,6 +2971,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two von Mises distributions are different.
    */
@@ -2950,7 +2980,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const __gnu_cxx::von_mises_distribution<_RealType>& __d1,
 	       const __gnu_cxx::von_mises_distribution<_RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A discrete hypergeometric random number distribution.
@@ -3024,9 +3054,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	      && (__p1._M_K == __p2._M_K)
 	      && (__p1._M_n == __p2._M_n); }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 
@@ -3212,6 +3244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two hypergeometric distributions are different.
    */
@@ -3220,6 +3253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const __gnu_cxx::hypergeometric_distribution<_UIntType>& __d1,
 	       const __gnu_cxx::hypergeometric_distribution<_UIntType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
   /**
    * @brief A logistic continuous distribution for random numbers.
@@ -3280,9 +3314,11 @@ _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; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	void _M_initialize();
@@ -3443,6 +3479,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       param_type _M_param;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two logistic distributions are not equal.
    */
@@ -3451,7 +3488,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator!=(const logistic_distribution<_RealType1>& __d1,
 	       const logistic_distribution<_RealType1>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A distribution for random coordinates on a unit sphere.
@@ -3479,9 +3516,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type&, const param_type&)
 	{ return true; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type&, const param_type&)
 	{ return false; }
+#endif
       };
 
       /**
@@ -3636,6 +3675,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::normal_distribution<_RealType> _M_nd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two uniform on sphere distributions are different.
    */
@@ -3646,7 +3686,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
 	       _RealType>& __d2)
     { return !(__d1 == __d2); }
-
+#endif
 
   /**
    * @brief A distribution for random coordinates inside a unit sphere.
@@ -3686,9 +3726,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	operator==(const param_type& __p1, const param_type& __p2)
 	{ return __p1._M_radius == __p2._M_radius; }
 
+#if __cpp_impl_three_way_comparison < 201907L
 	friend bool
 	operator!=(const param_type& __p1, const param_type& __p2)
 	{ return !(__p1 == __p2); }
+#endif
 
       private:
 	_RealType _M_radius;
@@ -3862,6 +3904,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       uniform_on_sphere_distribution<_Dimen, _RealType> _M_uosd;
     };
 
+#if __cpp_impl_three_way_comparison < 201907L
   /**
    * @brief Return true if two uniform on sphere distributions are different.
    */
@@ -3872,6 +3915,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       const __gnu_cxx::uniform_inside_sphere_distribution<_Dimen,
 	       _RealType>& __d2)
     { return !(__d1 == __d2); }
+#endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace __gnu_cxx

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-25 15:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 15:07 [gcc r13-4305] libstdc++: Do not define operator!= in <random> for C++20 Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).