diff --git a/sprout/algorithm/fixed/random_swap.hpp b/sprout/algorithm/fixed/random_swap.hpp index e38a7ad4..10717c86 100644 --- a/sprout/algorithm/fixed/random_swap.hpp +++ b/sprout/algorithm/fixed/random_swap.hpp @@ -10,7 +10,13 @@ #include #include #include -#include +#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint +#else +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution +#endif namespace sprout { namespace fixed { @@ -33,7 +39,7 @@ namespace sprout { make_random_swap_indexes(std::ptrdiff_t n, UniformRandomNumberGenerator&& g) { return n > 1 ? sprout::fixed::detail::make_random_swap_indexes_1( - sprout::random::uniform_int_distribution(0, n - 1)(sprout::forward(g)) + SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION(0, n - 1)(sprout::forward(g)) ) : sprout::array{{}} ; @@ -82,4 +88,6 @@ namespace sprout { using sprout::fixed::random_swap; } // namespace sprout +#undef SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION + #endif // #ifndef SPROUT_ALGORITHM_FIXED_RANDOM_SWAP_HPP diff --git a/sprout/algorithm/fixed/random_swap_result.hpp b/sprout/algorithm/fixed/random_swap_result.hpp index eb3e211e..19d320dc 100644 --- a/sprout/algorithm/fixed/random_swap_result.hpp +++ b/sprout/algorithm/fixed/random_swap_result.hpp @@ -12,7 +12,13 @@ #include #include #include -#include +#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint +#else +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution +#endif namespace sprout { namespace fixed { @@ -55,7 +61,7 @@ namespace sprout { > result_type; return n > 1 ? sprout::fixed::detail::make_random_swap_result_indexes_1( - sprout::random::uniform_int_distribution(0, n - 1)(sprout::forward(g)) + SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION(0, n - 1)(sprout::forward(g)) ) : result_type( sprout::array{{}}, @@ -126,4 +132,6 @@ namespace sprout { using sprout::fixed::random_swap_result; } // namespace sprout +#undef SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION + #endif // #ifndef SPROUT_ALGORITHM_FIXED_RANDOM_SWAP_RESULT_HPP diff --git a/sprout/algorithm/fixed/shuffle.hpp b/sprout/algorithm/fixed/shuffle.hpp index a70973ea..d2a5d54c 100644 --- a/sprout/algorithm/fixed/shuffle.hpp +++ b/sprout/algorithm/fixed/shuffle.hpp @@ -13,7 +13,13 @@ #include #include #include -#include +#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint +#else +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution +#endif namespace sprout { namespace fixed { @@ -37,7 +43,7 @@ namespace sprout { return n > 1 ? sprout::fixed::detail::make_shuffle_indexes_1( n, - sprout::random::uniform_int_distribution(0, n - 1)(sprout::forward(g)), + SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION(0, n - 1)(sprout::forward(g)), sprout::fixed::iota(sprout::pit >(), 0), 0 ) @@ -104,4 +110,6 @@ namespace sprout { using sprout::fixed::shuffle; } // namespace sprout +#undef SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION + #endif // #ifndef SPROUT_ALGORITHM_FIXED_SHUFFLE_HPP diff --git a/sprout/algorithm/fixed/shuffle_result.hpp b/sprout/algorithm/fixed/shuffle_result.hpp index 8c3d2195..2fd850d2 100644 --- a/sprout/algorithm/fixed/shuffle_result.hpp +++ b/sprout/algorithm/fixed/shuffle_result.hpp @@ -15,7 +15,13 @@ #include #include #include -#include +#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint +#else +# include +# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution +#endif namespace sprout { namespace fixed { @@ -56,7 +62,7 @@ namespace sprout { return n > 1 ? sprout::fixed::detail::make_shuffle_result_indexes_1( n, - sprout::random::uniform_int_distribution(0, n - 1)(sprout::forward(g)), + SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION(0, n - 1)(sprout::forward(g)), sprout::fixed::iota(sprout::pit >(), 0), 0 ) @@ -142,4 +148,6 @@ namespace sprout { using sprout::fixed::shuffle_result; } // namespace sprout +#undef SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION + #endif // #ifndef SPROUT_ALGORITHM_FIXED_SHUFFLE_RESULT_HPP