diff --git a/sprout/algorithm/cxx14/bogo_sort.hpp b/sprout/algorithm/cxx14/bogo_sort.hpp index 5e0242b6..77509267 100644 --- a/sprout/algorithm/cxx14/bogo_sort.hpp +++ b/sprout/algorithm/cxx14/bogo_sort.hpp @@ -9,6 +9,7 @@ #define SPROUT_ALGORITHM_CXX14_BOGO_SORT_HPP #include +#include #include #include @@ -20,14 +21,14 @@ namespace sprout { inline SPROUT_CXX14_CONSTEXPR void bogo_sort(RandomAccessIterator first, RandomAccessIterator last, UniformRandomNumberGenerator&& g) { while (!sprout::is_sorted(first, last)) { - sprout::shuffle(first, last, g); + sprout::shuffle(first, last, SPROUT_FORWARD(UniformRandomNumberGenerator, g)); } } template inline SPROUT_CXX14_CONSTEXPR void bogo_sort(RandomAccessIterator first, RandomAccessIterator last, UniformRandomNumberGenerator&& g, Compare comp) { while (!sprout::is_sorted(first, last, comp)) { - sprout::shuffle(first, last, g); + sprout::shuffle(first, last, SPROUT_FORWARD(UniformRandomNumberGenerator, g)); } } } // namespace sprout diff --git a/sprout/algorithm/cxx14/bozo_sort.hpp b/sprout/algorithm/cxx14/bozo_sort.hpp index 7d16ed11..fedc7c9e 100644 --- a/sprout/algorithm/cxx14/bozo_sort.hpp +++ b/sprout/algorithm/cxx14/bozo_sort.hpp @@ -9,6 +9,7 @@ #define SPROUT_ALGORITHM_CXX14_BOZO_SORT_HPP #include +#include #include #include @@ -20,14 +21,14 @@ namespace sprout { inline SPROUT_CXX14_CONSTEXPR void bozo_sort(RandomAccessIterator first, RandomAccessIterator last, UniformRandomNumberGenerator&& g) { while (!sprout::is_sorted(first, last)) { - sprout::random_swap(first, last, g); + sprout::random_swap(first, last, SPROUT_FORWARD(UniformRandomNumberGenerator, g)); } } template inline SPROUT_CXX14_CONSTEXPR void bozo_sort(RandomAccessIterator first, RandomAccessIterator last, UniformRandomNumberGenerator&& g, Compare comp) { while (!sprout::is_sorted(first, last, comp)) { - sprout::random_swap(first, last, g); + sprout::random_swap(first, last, SPROUT_FORWARD(UniformRandomNumberGenerator, g)); } } } // namespace sprout