mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
fix container_traits for array-like classes
fix coding style algorithm/
This commit is contained in:
parent
06f1933220
commit
0c00166c5f
123 changed files with 1608 additions and 2224 deletions
|
@ -19,13 +19,8 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<std::size_t N, typename Random>
|
||||
inline SPROUT_CONSTEXPR sprout::array<std::ptrdiff_t, N> make_shuffle_indexes_1(
|
||||
std::ptrdiff_t n,
|
||||
Random const& rnd,
|
||||
sprout::array<std::ptrdiff_t, N> const& arr,
|
||||
std::ptrdiff_t i
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::array<std::ptrdiff_t, N>
|
||||
make_shuffle_indexes_1(std::ptrdiff_t n, Random const& rnd, sprout::array<std::ptrdiff_t, N> const& arr, std::ptrdiff_t i) {
|
||||
return i < n - 1
|
||||
? sprout::fixed::detail::make_shuffle_indexes_1(
|
||||
n,
|
||||
|
@ -37,11 +32,8 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<std::size_t N, typename UniformRandomNumberGenerator>
|
||||
inline SPROUT_CONSTEXPR sprout::array<std::ptrdiff_t, N> make_shuffle_indexes(
|
||||
std::ptrdiff_t n,
|
||||
UniformRandomNumberGenerator&& g
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::array<std::ptrdiff_t, N>
|
||||
make_shuffle_indexes(std::ptrdiff_t n, UniformRandomNumberGenerator&& g) {
|
||||
return n > 1
|
||||
? sprout::fixed::detail::make_shuffle_indexes_1(
|
||||
n,
|
||||
|
@ -53,7 +45,8 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Container, typename Shuffled, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type shuffle_impl_1(
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
shuffle_impl_1(
|
||||
Container const& cont,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
Shuffled const& shuffled,
|
||||
|
@ -71,7 +64,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
template<typename Container, typename UniformRandomNumberGenerator, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type shuffle_impl(
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
shuffle_impl(
|
||||
Container const& cont,
|
||||
sprout::index_tuple<Indexes...> indexes,
|
||||
UniformRandomNumberGenerator&& g,
|
||||
|
@ -95,11 +89,8 @@ namespace sprout {
|
|||
// shuffle
|
||||
//
|
||||
template<typename Container, typename UniformRandomNumberGenerator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type shuffle(
|
||||
Container const& cont,
|
||||
UniformRandomNumberGenerator&& g
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
shuffle(Container const& cont, UniformRandomNumberGenerator&& g) {
|
||||
return sprout::fixed::detail::shuffle_impl(
|
||||
cont,
|
||||
sprout::index_range<0, sprout::container_traits<Container>::static_size>::make(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue