mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
workaroud for clang3.2 (shuffle, shuffle_result)
This commit is contained in:
parent
2ddd4014ce
commit
d39f4abe0f
4 changed files with 40 additions and 8 deletions
|
@ -10,7 +10,13 @@
|
|||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
# 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<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g))
|
||||
SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g))
|
||||
)
|
||||
: sprout::array<std::ptrdiff_t, 2>{{}}
|
||||
;
|
||||
|
@ -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
|
||||
|
|
|
@ -12,7 +12,13 @@
|
|||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
# 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<UniformRandomNumberGenerator>(
|
||||
sprout::random::uniform_int_distribution<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g))
|
||||
SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g))
|
||||
)
|
||||
: result_type(
|
||||
sprout::array<std::ptrdiff_t, 2>{{}},
|
||||
|
@ -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
|
||||
|
|
|
@ -13,7 +13,13 @@
|
|||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/numeric/fixed/iota.hpp>
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
# 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<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g)),
|
||||
SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g)),
|
||||
sprout::fixed::iota(sprout::pit<sprout::array<std::ptrdiff_t, N> >(), 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
|
||||
|
|
|
@ -15,7 +15,13 @@
|
|||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/numeric/fixed/iota.hpp>
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
# 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<UniformRandomNumberGenerator>(
|
||||
n,
|
||||
sprout::random::uniform_int_distribution<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g)),
|
||||
SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g)),
|
||||
sprout::fixed::iota(sprout::pit<sprout::array<std::ptrdiff_t, N> >(), 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
|
||||
|
|
Loading…
Reference in a new issue