2020-02-17 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/92546 (partial)
+ * include/bits/random.h (uniform_random_bit_generator): Move definition
+ to <bits/uniform_int_dist.h>.
+ * include/bits/ranges_algo.h: Include <bits/uniform_int_dist.h> instead
+ of <bits/random.h>.
+ * include/bits/ranges_algobase.h: Do not include <cmath>.
+ * include/bits/uniform_int_dist.h (uniform_random_bit_generator):
+ Move here.
+ * include/std/ranges: Do not include <limits>.
+ * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
+
PR libstdc++/92546 (partial)
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
#include <vector>
#include <bits/uniform_int_dist.h>
-#if __cplusplus > 201703L
-# include <concepts>
-#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
* @{
*/
-#ifdef __cpp_lib_concepts
- /// Requirements for a uniform random bit generator.
- template<typename _Gen>
- concept uniform_random_bit_generator
- = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>>
- && requires
- {
- { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
- { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
- requires bool_constant<(_Gen::min() < _Gen::max())>::value;
- };
-#endif
+ // std::uniform_random_bit_generator is defined in <bits/uniform_int_dist.h>
/**
* @brief A function template for converting the output of a (integral)
#if __cplusplus > 201703L
#include <bits/ranges_algobase.h>
-#include <bits/random.h> // concept uniform_random_bit_generator
+#include <bits/uniform_int_dist.h> // concept uniform_random_bit_generator
#if __cpp_lib_concepts
namespace std _GLIBCXX_VISIBILITY(default)
#if __cplusplus > 201703L
-#include <cmath>
#include <compare>
#include <iterator>
// #include <bits/range_concepts.h>
#include <type_traits>
#include <limits>
+#if __cplusplus > 201703L
+# include <concepts>
+#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#ifdef __cpp_lib_concepts
+ /// Requirements for a uniform random bit generator.
+ template<typename _Gen>
+ concept uniform_random_bit_generator
+ = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>>
+ && requires
+ {
+ { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
+ { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
+ requires bool_constant<(_Gen::min() < _Gen::max())>::value;
+ };
+#endif
+
namespace __detail
{
/* Determine whether number is a power of 2. */
#include <compare>
#include <initializer_list>
#include <iterator>
-#include <limits>
#include <optional>
#include <tuple>
auto x = std::generate_canonical<std::size_t,
std::numeric_limits<std::size_t>::digits>(urng);
-// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 172 }
+// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 158 }
// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 3281 }