From cd16923347b1f1a6d6a448e8a413127972d58030 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 9 Apr 2014 18:11:40 +0900 Subject: [PATCH] add C++14 constexpr range algorithms --- sprout/algorithm/cxx14/move_backward.hpp | 8 +- sprout/random/uniform_01.hpp | 8 +- sprout/random/uniform_real_distribution.hpp | 8 +- sprout/range/algorithm/cxx14.hpp | 65 +++++++++++++++++ sprout/range/algorithm/cxx14/bogo_sort.hpp | 40 ++++++++++ sprout/range/algorithm/cxx14/bozo_sort.hpp | 40 ++++++++++ sprout/range/algorithm/cxx14/clamp_range.hpp | 53 ++++++++++++++ sprout/range/algorithm/cxx14/copy.hpp | 33 +++++++++ .../range/algorithm/cxx14/copy_backward.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/copy_if.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/copy_until.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/copy_while.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/fill.hpp | 29 ++++++++ sprout/range/algorithm/cxx14/generate.hpp | 29 ++++++++ .../range/algorithm/cxx14/inplace_merge.hpp | 37 ++++++++++ sprout/range/algorithm/cxx14/make_heap.hpp | 35 +++++++++ sprout/range/algorithm/cxx14/merge.hpp | 41 +++++++++++ sprout/range/algorithm/cxx14/move.hpp | 33 +++++++++ .../range/algorithm/cxx14/move_backward.hpp | 33 +++++++++ .../algorithm/cxx14/next_permutation.hpp | 35 +++++++++ sprout/range/algorithm/cxx14/nth_element.hpp | 37 ++++++++++ sprout/range/algorithm/cxx14/partial_sort.hpp | 37 ++++++++++ .../algorithm/cxx14/partial_sort_copy.hpp | 73 +++++++++++++++++++ sprout/range/algorithm/cxx14/partition.hpp | 42 +++++++++++ .../range/algorithm/cxx14/partition_copy.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/pop_heap.hpp | 35 +++++++++ .../algorithm/cxx14/prev_permutation.hpp | 35 +++++++++ sprout/range/algorithm/cxx14/push_heap.hpp | 35 +++++++++ .../range/algorithm/cxx14/random_shuffle.hpp | 32 ++++++++ sprout/range/algorithm/cxx14/random_swap.hpp | 32 ++++++++ sprout/range/algorithm/cxx14/remove.hpp | 42 +++++++++++ sprout/range/algorithm/cxx14/remove_copy.hpp | 33 +++++++++ .../range/algorithm/cxx14/remove_copy_if.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/remove_if.hpp | 42 +++++++++++ sprout/range/algorithm/cxx14/replace.hpp | 29 ++++++++ sprout/range/algorithm/cxx14/replace_copy.hpp | 33 +++++++++ .../range/algorithm/cxx14/replace_copy_if.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/replace_if.hpp | 29 ++++++++ sprout/range/algorithm/cxx14/reverse.hpp | 29 ++++++++ sprout/range/algorithm/cxx14/reverse_copy.hpp | 33 +++++++++ sprout/range/algorithm/cxx14/rotate.hpp | 44 +++++++++++ sprout/range/algorithm/cxx14/rotate_copy.hpp | 38 ++++++++++ sprout/range/algorithm/cxx14/sample.hpp | 34 +++++++++ .../range/algorithm/cxx14/set_difference.hpp | 41 +++++++++++ .../algorithm/cxx14/set_intersection.hpp | 41 +++++++++++ .../cxx14/set_symmetric_difference.hpp | 41 +++++++++++ sprout/range/algorithm/cxx14/set_union.hpp | 41 +++++++++++ sprout/range/algorithm/cxx14/shuffle.hpp | 32 ++++++++ sprout/range/algorithm/cxx14/sort.hpp | 35 +++++++++ sprout/range/algorithm/cxx14/sort_heap.hpp | 35 +++++++++ .../algorithm/cxx14/stable_partition.hpp | 42 +++++++++++ sprout/range/algorithm/cxx14/stable_sort.hpp | 35 +++++++++ sprout/range/algorithm/cxx14/swap_ranges.hpp | 48 ++++++++++++ sprout/range/algorithm/cxx14/transform.hpp | 41 +++++++++++ sprout/range/algorithm/cxx14/unique.hpp | 58 +++++++++++++++ sprout/range/algorithm/cxx14/unique_copy.hpp | 41 +++++++++++ sprout/range/algorithm/modifying.hpp | 1 + 57 files changed, 2022 insertions(+), 12 deletions(-) create mode 100644 sprout/range/algorithm/cxx14.hpp create mode 100644 sprout/range/algorithm/cxx14/bogo_sort.hpp create mode 100644 sprout/range/algorithm/cxx14/bozo_sort.hpp create mode 100644 sprout/range/algorithm/cxx14/clamp_range.hpp create mode 100644 sprout/range/algorithm/cxx14/copy.hpp create mode 100644 sprout/range/algorithm/cxx14/copy_backward.hpp create mode 100644 sprout/range/algorithm/cxx14/copy_if.hpp create mode 100644 sprout/range/algorithm/cxx14/copy_until.hpp create mode 100644 sprout/range/algorithm/cxx14/copy_while.hpp create mode 100644 sprout/range/algorithm/cxx14/fill.hpp create mode 100644 sprout/range/algorithm/cxx14/generate.hpp create mode 100644 sprout/range/algorithm/cxx14/inplace_merge.hpp create mode 100644 sprout/range/algorithm/cxx14/make_heap.hpp create mode 100644 sprout/range/algorithm/cxx14/merge.hpp create mode 100644 sprout/range/algorithm/cxx14/move.hpp create mode 100644 sprout/range/algorithm/cxx14/move_backward.hpp create mode 100644 sprout/range/algorithm/cxx14/next_permutation.hpp create mode 100644 sprout/range/algorithm/cxx14/nth_element.hpp create mode 100644 sprout/range/algorithm/cxx14/partial_sort.hpp create mode 100644 sprout/range/algorithm/cxx14/partial_sort_copy.hpp create mode 100644 sprout/range/algorithm/cxx14/partition.hpp create mode 100644 sprout/range/algorithm/cxx14/partition_copy.hpp create mode 100644 sprout/range/algorithm/cxx14/pop_heap.hpp create mode 100644 sprout/range/algorithm/cxx14/prev_permutation.hpp create mode 100644 sprout/range/algorithm/cxx14/push_heap.hpp create mode 100644 sprout/range/algorithm/cxx14/random_shuffle.hpp create mode 100644 sprout/range/algorithm/cxx14/random_swap.hpp create mode 100644 sprout/range/algorithm/cxx14/remove.hpp create mode 100644 sprout/range/algorithm/cxx14/remove_copy.hpp create mode 100644 sprout/range/algorithm/cxx14/remove_copy_if.hpp create mode 100644 sprout/range/algorithm/cxx14/remove_if.hpp create mode 100644 sprout/range/algorithm/cxx14/replace.hpp create mode 100644 sprout/range/algorithm/cxx14/replace_copy.hpp create mode 100644 sprout/range/algorithm/cxx14/replace_copy_if.hpp create mode 100644 sprout/range/algorithm/cxx14/replace_if.hpp create mode 100644 sprout/range/algorithm/cxx14/reverse.hpp create mode 100644 sprout/range/algorithm/cxx14/reverse_copy.hpp create mode 100644 sprout/range/algorithm/cxx14/rotate.hpp create mode 100644 sprout/range/algorithm/cxx14/rotate_copy.hpp create mode 100644 sprout/range/algorithm/cxx14/sample.hpp create mode 100644 sprout/range/algorithm/cxx14/set_difference.hpp create mode 100644 sprout/range/algorithm/cxx14/set_intersection.hpp create mode 100644 sprout/range/algorithm/cxx14/set_symmetric_difference.hpp create mode 100644 sprout/range/algorithm/cxx14/set_union.hpp create mode 100644 sprout/range/algorithm/cxx14/shuffle.hpp create mode 100644 sprout/range/algorithm/cxx14/sort.hpp create mode 100644 sprout/range/algorithm/cxx14/sort_heap.hpp create mode 100644 sprout/range/algorithm/cxx14/stable_partition.hpp create mode 100644 sprout/range/algorithm/cxx14/stable_sort.hpp create mode 100644 sprout/range/algorithm/cxx14/swap_ranges.hpp create mode 100644 sprout/range/algorithm/cxx14/transform.hpp create mode 100644 sprout/range/algorithm/cxx14/unique.hpp create mode 100644 sprout/range/algorithm/cxx14/unique_copy.hpp diff --git a/sprout/algorithm/cxx14/move_backward.hpp b/sprout/algorithm/cxx14/move_backward.hpp index 6f0c4d0e..0638de50 100644 --- a/sprout/algorithm/cxx14/move_backward.hpp +++ b/sprout/algorithm/cxx14/move_backward.hpp @@ -18,11 +18,11 @@ namespace sprout { // 25.3.2 Move // template< - typename InputIterator, typename OutputIterator, - typename sprout::enabler_if::value>::type = sprout::enabler + typename BidirectionalIterator1, typename BidirectionalIterator2, + typename sprout::enabler_if::value>::type = sprout::enabler > - inline SPROUT_CXX14_CONSTEXPR OutputIterator - move_backward(InputIterator first, InputIterator last, OutputIterator result) { + inline SPROUT_CXX14_CONSTEXPR BidirectionalIterator2 + move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result) { while (first != last) { *--result = sprout::move(*--first); } diff --git a/sprout/random/uniform_01.hpp b/sprout/random/uniform_01.hpp index fea278f7..ef0b8b46 100644 --- a/sprout/random/uniform_01.hpp +++ b/sprout/random/uniform_01.hpp @@ -1,9 +1,9 @@ /*============================================================================= - Copyright (c) 2011-2014 Bolero MURAKAMI - https://github.com/bolero-MURAKAMI/Sprout + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_RANDOM_UNIFORM_01_HPP #define SPROUT_RANDOM_UNIFORM_01_HPP diff --git a/sprout/random/uniform_real_distribution.hpp b/sprout/random/uniform_real_distribution.hpp index 26cac318..12b57d8f 100644 --- a/sprout/random/uniform_real_distribution.hpp +++ b/sprout/random/uniform_real_distribution.hpp @@ -1,9 +1,9 @@ /*============================================================================= - Copyright (c) 2011-2014 Bolero MURAKAMI - https://github.com/bolero-MURAKAMI/Sprout + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP #define SPROUT_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP diff --git a/sprout/range/algorithm/cxx14.hpp b/sprout/range/algorithm/cxx14.hpp new file mode 100644 index 00000000..f8a7ec98 --- /dev/null +++ b/sprout/range/algorithm/cxx14.hpp @@ -0,0 +1,65 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_HPP diff --git a/sprout/range/algorithm/cxx14/bogo_sort.hpp b/sprout/range/algorithm/cxx14/bogo_sort.hpp new file mode 100644 index 00000000..1052068c --- /dev/null +++ b/sprout/range/algorithm/cxx14/bogo_sort.hpp @@ -0,0 +1,40 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_BOGO_SORT_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_BOGO_SORT_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // bogo_sort + // + template + inline SPROUT_CXX14_CONSTEXPR void + bogo_sort(RandomAccessRange&& rng, UniformRandomNumberGenerator&& g) { + sprout::bogo_sort( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(UniformRandomNumberGenerator, g) + ); + } + template + inline SPROUT_CXX14_CONSTEXPR void + bogo_sort(RandomAccessRange&& rng, UniformRandomNumberGenerator&& g, Compare comp) { + sprout::bogo_sort( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(UniformRandomNumberGenerator, g), comp + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_BOGO_SORT_HPP diff --git a/sprout/range/algorithm/cxx14/bozo_sort.hpp b/sprout/range/algorithm/cxx14/bozo_sort.hpp new file mode 100644 index 00000000..a50944cd --- /dev/null +++ b/sprout/range/algorithm/cxx14/bozo_sort.hpp @@ -0,0 +1,40 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_BOZO_SORT_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_BOZO_SORT_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // bozo_sort + // + template + inline SPROUT_CXX14_CONSTEXPR void + bozo_sort(RandomAccessRange&& rng, UniformRandomNumberGenerator&& g) { + sprout::bozo_sort( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(UniformRandomNumberGenerator, g) + ); + } + template + inline SPROUT_CXX14_CONSTEXPR void + bozo_sort(RandomAccessRange&& rng, UniformRandomNumberGenerator&& g, Compare comp) { + sprout::bozo_sort( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(UniformRandomNumberGenerator, g), comp + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_BOZO_SORT_HPP diff --git a/sprout/range/algorithm/cxx14/clamp_range.hpp b/sprout/range/algorithm/cxx14/clamp_range.hpp new file mode 100644 index 00000000..62f3974d --- /dev/null +++ b/sprout/range/algorithm/cxx14/clamp_range.hpp @@ -0,0 +1,53 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_CLAMP_RANGE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_CLAMP_RANGE_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // clamp_range + // + template< + typename InputRange, typename OutputIterator, typename Compare, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + clamp_range( + InputRange const& rng, OutputIterator result, + typename sprout::container_traits::value_type const& low, + typename sprout::container_traits::value_type const& high, + Compare comp + ) + { + return sprout::clamp_range(sprout::begin(rng), sprout::end(rng), result, low, high, comp); + } + template< + typename InputRange, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + clamp_range( + InputRange const& rng, OutputIterator result, + typename sprout::container_traits::value_type const& low, + typename sprout::container_traits::value_type const& high + ) + { + return sprout::clamp_range(sprout::begin(rng), sprout::end(rng), result, low, high); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_CLAMP_RANGE_HPP diff --git a/sprout/range/algorithm/cxx14/copy.hpp b/sprout/range/algorithm/cxx14/copy.hpp new file mode 100644 index 00000000..be584d63 --- /dev/null +++ b/sprout/range/algorithm/cxx14/copy.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_COPY_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // copy + // + template< + typename InputRange, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + copy(InputRange const& rng, OutputIterator result) { + return sprout::copy(sprout::begin(rng), sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/copy_backward.hpp b/sprout/range/algorithm/cxx14/copy_backward.hpp new file mode 100644 index 00000000..3c895b17 --- /dev/null +++ b/sprout/range/algorithm/cxx14/copy_backward.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_BACKWARD_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_COPY_BACKWARD_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // copy_backward + // + template< + typename BidirectionalRange, typename BidirectionalIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR BidirectionalIterator + copy_backward(BidirectionalRange const& rng, BidirectionalIterator result) { + return sprout::copy_backward(sprout::begin(rng), sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_BACKWARD_HPP diff --git a/sprout/range/algorithm/cxx14/copy_if.hpp b/sprout/range/algorithm/cxx14/copy_if.hpp new file mode 100644 index 00000000..7cf01222 --- /dev/null +++ b/sprout/range/algorithm/cxx14/copy_if.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_IF_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_COPY_IF_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // copy_if + // + template< + typename InputRange, typename OutputIterator, typename Predicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + copy_if(InputRange const& rng, OutputIterator result, Predicate pred) { + return sprout::copy_if(sprout::begin(rng), sprout::end(rng), result, pred); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_IF_HPP diff --git a/sprout/range/algorithm/cxx14/copy_until.hpp b/sprout/range/algorithm/cxx14/copy_until.hpp new file mode 100644 index 00000000..505e6912 --- /dev/null +++ b/sprout/range/algorithm/cxx14/copy_until.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_UNTIL_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_COPY_UNTIL_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // copy_until + // + template< + typename InputRange, typename OutputIterator, typename Predicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + copy_until(InputRange const& rng, OutputIterator result, Predicate pred) { + return sprout::copy_until(sprout::begin(rng), sprout::end(rng), result, pred); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_UNTIL_HPP diff --git a/sprout/range/algorithm/cxx14/copy_while.hpp b/sprout/range/algorithm/cxx14/copy_while.hpp new file mode 100644 index 00000000..63d0f4b5 --- /dev/null +++ b/sprout/range/algorithm/cxx14/copy_while.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_WHILE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_COPY_WHILE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // copy_while + // + template< + typename InputRange, typename OutputIterator, typename Predicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + copy_while(InputRange const& rng, OutputIterator result, Predicate pred) { + return sprout::copy_while(sprout::begin(rng), sprout::end(rng), result, pred); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_WHILE_HPP diff --git a/sprout/range/algorithm/cxx14/fill.hpp b/sprout/range/algorithm/cxx14/fill.hpp new file mode 100644 index 00000000..0e2e1b4e --- /dev/null +++ b/sprout/range/algorithm/cxx14/fill.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_FILL_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_FILL_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // fill + // + template + inline SPROUT_CXX14_CONSTEXPR void + fill(ForwardRange&& rng, T const& value) { + sprout::fill(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), value); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_FILL_HPP diff --git a/sprout/range/algorithm/cxx14/generate.hpp b/sprout/range/algorithm/cxx14/generate.hpp new file mode 100644 index 00000000..40d20670 --- /dev/null +++ b/sprout/range/algorithm/cxx14/generate.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_GENERATE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_GENERATE_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // generate + // + template + inline SPROUT_CXX14_CONSTEXPR void + generate(ForwardRange&& rng, Generator gen) { + sprout::generate(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), gen); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_GENERATE_HPP diff --git a/sprout/range/algorithm/cxx14/inplace_merge.hpp b/sprout/range/algorithm/cxx14/inplace_merge.hpp new file mode 100644 index 00000000..b174dded --- /dev/null +++ b/sprout/range/algorithm/cxx14/inplace_merge.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_IMPLACE_MERGE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_IMPLACE_MERGE_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // inplace_merge + // + template + inline SPROUT_CXX14_CONSTEXPR void + inplace_merge(BidirectionalRange&& rng, typename sprout::container_traits::type>::iterator middle, Compare comp) { + sprout::inplace_merge(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), middle, sprout::end(SPROUT_FORWARD(BidirectionalRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + inplace_merge(BidirectionalRange&& rng, typename sprout::container_traits::type>::iterator middle) { + sprout::inplace_merge(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), middle, sprout::end(SPROUT_FORWARD(BidirectionalRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_IMPLACE_MERGE_HPP diff --git a/sprout/range/algorithm/cxx14/make_heap.hpp b/sprout/range/algorithm/cxx14/make_heap.hpp new file mode 100644 index 00000000..1f3c5b68 --- /dev/null +++ b/sprout/range/algorithm/cxx14/make_heap.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_MAKE_HEAP_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_MAKE_HEAP_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // make_heap + // + template + inline SPROUT_CXX14_CONSTEXPR void + make_heap(RandomAccessRange&& rng, Compare comp) { + sprout::make_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + make_heap(RandomAccessRange&& rng) { + sprout::make_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_MAKE_HEAP_HPP diff --git a/sprout/range/algorithm/cxx14/merge.hpp b/sprout/range/algorithm/cxx14/merge.hpp new file mode 100644 index 00000000..c4fe24b1 --- /dev/null +++ b/sprout/range/algorithm/cxx14/merge.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_MERGE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_MERGE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // merge + // + template< + typename InputRange1, typename InputRange2, typename OutputIterator, typename Compare, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + merge(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result, Compare comp) { + return sprout::merge(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result, comp); + } + template< + typename InputRange1, typename InputRange2, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + merge(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result) { + return sprout::merge(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_MERGE_HPP diff --git a/sprout/range/algorithm/cxx14/move.hpp b/sprout/range/algorithm/cxx14/move.hpp new file mode 100644 index 00000000..c4676561 --- /dev/null +++ b/sprout/range/algorithm/cxx14/move.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_MOVE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_MOVE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // move + // + template< + typename InputRange, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + move(InputRange const& rng, OutputIterator result) { + return sprout::move(sprout::begin(rng), sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_MOVE_HPP diff --git a/sprout/range/algorithm/cxx14/move_backward.hpp b/sprout/range/algorithm/cxx14/move_backward.hpp new file mode 100644 index 00000000..91e321d7 --- /dev/null +++ b/sprout/range/algorithm/cxx14/move_backward.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_MOVE_BACKWARD_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_COPY_BACKWARD_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // move_backward + // + template< + typename BidirectionalRange, typename BidirectionalIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR BidirectionalIterator + move_backward(BidirectionalRange const& rng, BidirectionalIterator result) { + return sprout::move_backward(sprout::begin(rng), sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_COPY_BACKWARD_HPP diff --git a/sprout/range/algorithm/cxx14/next_permutation.hpp b/sprout/range/algorithm/cxx14/next_permutation.hpp new file mode 100644 index 00000000..843ef4ed --- /dev/null +++ b/sprout/range/algorithm/cxx14/next_permutation.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_NEXT_PERMUTATION_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_NEXT_PERMUTATION_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // next_permutation + // + template + inline SPROUT_CXX14_CONSTEXPR bool + next_permutation(BidirectionalRange&& rng, Compare comp) { + return sprout::next_permutation(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR bool + next_permutation(BidirectionalRange&& rng) { + return sprout::next_permutation(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_NEXT_PERMUTATION_HPP diff --git a/sprout/range/algorithm/cxx14/nth_element.hpp b/sprout/range/algorithm/cxx14/nth_element.hpp new file mode 100644 index 00000000..0922f6ee --- /dev/null +++ b/sprout/range/algorithm/cxx14/nth_element.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_NTH_ELEMENT_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_NTH_ELEMENT_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // nth_element + // + template + inline SPROUT_CXX14_CONSTEXPR void + nth_element(RandomAccessRange&& rng, typename sprout::container_traits::type>::iterator nth, Compare comp) { + sprout::nth_element(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), nth, sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + nth_element(RandomAccessRange&& rng, typename sprout::container_traits::type>::iterator nth) { + sprout::nth_element(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), nth, sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_NTH_ELEMENT_HPP diff --git a/sprout/range/algorithm/cxx14/partial_sort.hpp b/sprout/range/algorithm/cxx14/partial_sort.hpp new file mode 100644 index 00000000..de485f15 --- /dev/null +++ b/sprout/range/algorithm/cxx14/partial_sort.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTIAL_SORT_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_PARTIAL_SORT_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // partial_sort + // + template + inline SPROUT_CXX14_CONSTEXPR void + partial_sort(RandomAccessRange&& rng, typename sprout::container_traits::type>::iterator middle, Compare comp) { + sprout::partial_sort(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), middle, sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + partial_sort(RandomAccessRange&& rng, typename sprout::container_traits::type>::iterator middle) { + sprout::partial_sort(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), middle, sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTIAL_SORT_HPP diff --git a/sprout/range/algorithm/cxx14/partial_sort_copy.hpp b/sprout/range/algorithm/cxx14/partial_sort_copy.hpp new file mode 100644 index 00000000..692f2d5c --- /dev/null +++ b/sprout/range/algorithm/cxx14/partial_sort_copy.hpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTIAL_SORT_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_PARTIAL_SORT_COPY_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // partial_sort_copy + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + partial_sort_copy(InputRange const& rng1, RandomAccessRange&& rng2, Compare comp) { + return sprout::range::range_return::pack( + sprout::partial_sort_copy( + sprout::begin(rng1), sprout::end(rng1), + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng2)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng2)), + comp + ), + SPROUT_FORWARD(RandomAccessRange, rng2) + ); + } + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + partial_sort_copy(InputRange const& rng1, RandomAccessRange&& rng2, Compare comp) { + return sprout::range::range_return::pack( + sprout::partial_sort_copy( + sprout::begin(rng1), sprout::end(rng1), + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng2)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng2)), + comp + ), + SPROUT_FORWARD(RandomAccessRange, rng2) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + partial_sort_copy(InputRange const& rng1, RandomAccessRange&& rng2) { + return sprout::range::range_return::pack( + sprout::partial_sort_copy( + sprout::begin(rng1), sprout::end(rng1), + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng2)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng2)) + ), + SPROUT_FORWARD(RandomAccessRange, rng2) + ); + } + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + partial_sort_copy(InputRange const& rng1, RandomAccessRange&& rng2) { + return sprout::range::range_return::pack( + sprout::partial_sort_copy( + sprout::begin(rng1), sprout::end(rng1), + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng2)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng2)) + ), + SPROUT_FORWARD(RandomAccessRange, rng2) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTIAL_SORT_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/partition.hpp b/sprout/range/algorithm/cxx14/partition.hpp new file mode 100644 index 00000000..f1a57280 --- /dev/null +++ b/sprout/range/algorithm/cxx14/partition.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTITION_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_PARTITION_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // partition + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + partition(ForwardRange&& rng, Predicate pred) { + return sprout::range::range_return::pack( + sprout::partition(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + partition(ForwardRange&& rng, Predicate pred) { + return sprout::range::range_return::pack( + sprout::partition(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTITION_HPP diff --git a/sprout/range/algorithm/cxx14/partition_copy.hpp b/sprout/range/algorithm/cxx14/partition_copy.hpp new file mode 100644 index 00000000..c3903421 --- /dev/null +++ b/sprout/range/algorithm/cxx14/partition_copy.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTITION_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_PARTITION_COPY_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // partition_copy + // + template< + typename InputRange, typename OutputIterator, typename Predicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + partition_copy(InputRange const& rng, OutputIterator result, Predicate pred) { + return sprout::partition_copy(sprout::begin(rng), sprout::end(rng), result, pred); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_PARTITION_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/pop_heap.hpp b/sprout/range/algorithm/cxx14/pop_heap.hpp new file mode 100644 index 00000000..4b90abb1 --- /dev/null +++ b/sprout/range/algorithm/cxx14/pop_heap.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_POP_HEAP_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_POP_HEAP_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // pop_heap + // + template + inline SPROUT_CXX14_CONSTEXPR void + pop_heap(RandomAccessRange&& rng, Compare comp) { + sprout::pop_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + pop_heap(RandomAccessRange&& rng) { + sprout::pop_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_POP_HEAP_HPP diff --git a/sprout/range/algorithm/cxx14/prev_permutation.hpp b/sprout/range/algorithm/cxx14/prev_permutation.hpp new file mode 100644 index 00000000..6078239f --- /dev/null +++ b/sprout/range/algorithm/cxx14/prev_permutation.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_PREV_PERMUTATION_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_PREV_PERMUTATION_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // prev_permutation + // + template + inline SPROUT_CXX14_CONSTEXPR bool + prev_permutation(BidirectionalRange&& rng, Compare comp) { + return sprout::prev_permutation(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR bool + prev_permutation(BidirectionalRange&& rng) { + return sprout::prev_permutation(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_PREV_PERMUTATION_HPP diff --git a/sprout/range/algorithm/cxx14/push_heap.hpp b/sprout/range/algorithm/cxx14/push_heap.hpp new file mode 100644 index 00000000..39868eeb --- /dev/null +++ b/sprout/range/algorithm/cxx14/push_heap.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_PUSH_HEAP_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_PUSH_HEAP_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // push_heap + // + template + inline SPROUT_CXX14_CONSTEXPR void + push_heap(RandomAccessRange&& rng, Compare comp) { + sprout::push_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + push_heap(RandomAccessRange&& rng) { + sprout::push_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_PUSH_HEAP_HPP diff --git a/sprout/range/algorithm/cxx14/random_shuffle.hpp b/sprout/range/algorithm/cxx14/random_shuffle.hpp new file mode 100644 index 00000000..f9162da1 --- /dev/null +++ b/sprout/range/algorithm/cxx14/random_shuffle.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_RANDOM_SHUFFLE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_RANDOM_SHUFFLE_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // random_shuffle + // + template + inline SPROUT_CXX14_CONSTEXPR void + random_shuffle(RandomAccessRange&& rng, RandomNumberGenerator&& rand) { + sprout::random_shuffle( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(RandomNumberGenerator, rand) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_RANDOM_SHUFFLE_HPP diff --git a/sprout/range/algorithm/cxx14/random_swap.hpp b/sprout/range/algorithm/cxx14/random_swap.hpp new file mode 100644 index 00000000..b787c806 --- /dev/null +++ b/sprout/range/algorithm/cxx14/random_swap.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_RANDOM_SWAP_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_RANDOM_SWAP_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // random_swap + // + template + inline SPROUT_CXX14_CONSTEXPR void + random_swap(RandomAccessRange&& rng, UniformRandomNumberGenerator&& g) { + sprout::random_swap( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(UniformRandomNumberGenerator, g) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_RANDOM_SWAP_HPP diff --git a/sprout/range/algorithm/cxx14/remove.hpp b/sprout/range/algorithm/cxx14/remove.hpp new file mode 100644 index 00000000..c15c072a --- /dev/null +++ b/sprout/range/algorithm/cxx14/remove.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // remove + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + remove(ForwardRange&& rng, T const& value) { + return sprout::range::range_return::pack( + sprout::remove(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), value), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + remove(ForwardRange&& rng, T const& value) { + return sprout::range::range_return::pack( + sprout::remove(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), value), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_HPP diff --git a/sprout/range/algorithm/cxx14/remove_copy.hpp b/sprout/range/algorithm/cxx14/remove_copy.hpp new file mode 100644 index 00000000..a3d14cc5 --- /dev/null +++ b/sprout/range/algorithm/cxx14/remove_copy.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_COPY_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // remove_copy + // + template< + typename InputRange, typename OutputIterator, typename T, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + remove_copy(InputRange const& rng, OutputIterator result, T const& value) { + return sprout::remove_copy(sprout::begin(rng), sprout::end(rng), result, value); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/remove_copy_if.hpp b/sprout/range/algorithm/cxx14/remove_copy_if.hpp new file mode 100644 index 00000000..42d15fa8 --- /dev/null +++ b/sprout/range/algorithm/cxx14/remove_copy_if.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_COPY_IF_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_COPY_IF_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // remove_copy_if + // + template< + typename InputRange, typename OutputIterator, typename Predicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + remove_copy_if(InputRange const& rng, OutputIterator result, Predicate pred) { + return sprout::remove_copy_if(sprout::begin(rng), sprout::end(rng), result, pred); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_COPY_IF_HPP diff --git a/sprout/range/algorithm/cxx14/remove_if.hpp b/sprout/range/algorithm/cxx14/remove_if.hpp new file mode 100644 index 00000000..9d442763 --- /dev/null +++ b/sprout/range/algorithm/cxx14/remove_if.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_IF_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_IF_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // remove_if + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + remove_if(ForwardRange&& rng, Predicate pred) { + return sprout::range::range_return::pack( + sprout::remove_if(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + remove_if(ForwardRange&& rng, Predicate pred) { + return sprout::range::range_return::pack( + sprout::remove_if(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REMOVE_HPP diff --git a/sprout/range/algorithm/cxx14/replace.hpp b/sprout/range/algorithm/cxx14/replace.hpp new file mode 100644 index 00000000..aa452367 --- /dev/null +++ b/sprout/range/algorithm/cxx14/replace.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // replace + // + template + inline SPROUT_CXX14_CONSTEXPR void + replace(ForwardRange&& rng, T const& old_value, T const& new_value) { + sprout::replace(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), old_value, new_value); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_HPP diff --git a/sprout/range/algorithm/cxx14/replace_copy.hpp b/sprout/range/algorithm/cxx14/replace_copy.hpp new file mode 100644 index 00000000..a69f987e --- /dev/null +++ b/sprout/range/algorithm/cxx14/replace_copy.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_COPY_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // replace_copy + // + template< + typename InputRange, typename OutputIterator, typename T, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + replace_copy(InputRange const& rng, OutputIterator result, T const& old_value, T const& new_value) { + return sprout::replace_copy(sprout::begin(rng), sprout::end(rng), result, old_value, new_value); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/replace_copy_if.hpp b/sprout/range/algorithm/cxx14/replace_copy_if.hpp new file mode 100644 index 00000000..8d1d2782 --- /dev/null +++ b/sprout/range/algorithm/cxx14/replace_copy_if.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_COPY_IF_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_COPY_IF_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // replace_copy_if + // + template< + typename InputRange, typename OutputIterator, typename T, typename Predicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + replace_copy_if(InputRange const& rng, OutputIterator result, Predicate pred, T const& new_value) { + return sprout::replace_copy_if(sprout::begin(rng), sprout::end(rng), result, pred, new_value); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_COPY_IF_HPP diff --git a/sprout/range/algorithm/cxx14/replace_if.hpp b/sprout/range/algorithm/cxx14/replace_if.hpp new file mode 100644 index 00000000..2994fbf1 --- /dev/null +++ b/sprout/range/algorithm/cxx14/replace_if.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_IF_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_IF_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // replace_if + // + template + inline SPROUT_CXX14_CONSTEXPR void + replace_if(ForwardRange&& rng, Predicate pred, T const& new_value) { + sprout::replace_if(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred, new_value); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REPLACE_IF_HPP diff --git a/sprout/range/algorithm/cxx14/reverse.hpp b/sprout/range/algorithm/cxx14/reverse.hpp new file mode 100644 index 00000000..55aeb995 --- /dev/null +++ b/sprout/range/algorithm/cxx14/reverse.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REVERSE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REVERSE_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // reverse + // + template + inline SPROUT_CXX14_CONSTEXPR void + reverse(BidirectionalRange&& rng) { + sprout::reverse(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REVERSE_HPP diff --git a/sprout/range/algorithm/cxx14/reverse_copy.hpp b/sprout/range/algorithm/cxx14/reverse_copy.hpp new file mode 100644 index 00000000..46f21be9 --- /dev/null +++ b/sprout/range/algorithm/cxx14/reverse_copy.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_REVERSE_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_REVERSE_COPY_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // reverse_copy + // + template< + typename BidirectionalRange, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + reverse_copy(BidirectionalRange const& rng, OutputIterator result) { + return sprout::reverse_copy(sprout::begin(rng), sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_REVERSE_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/rotate.hpp b/sprout/range/algorithm/cxx14/rotate.hpp new file mode 100644 index 00000000..d3e79e1d --- /dev/null +++ b/sprout/range/algorithm/cxx14/rotate.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_ROTATE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_ROTATE_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // rotate + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + rotate(ForwardRange&& rng, typename sprout::container_traits::type>::iterator middle) { + return sprout::range::range_return::pack( + sprout::rotate(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), middle, sprout::end(SPROUT_FORWARD(ForwardRange, rng))), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + rotate(ForwardRange&& rng, typename sprout::container_traits::type>::iterator middle) { + return sprout::range::range_return::pack( + sprout::rotate(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), middle, sprout::end(SPROUT_FORWARD(ForwardRange, rng))), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_ROTATE_HPP diff --git a/sprout/range/algorithm/cxx14/rotate_copy.hpp b/sprout/range/algorithm/cxx14/rotate_copy.hpp new file mode 100644 index 00000000..7d727c3f --- /dev/null +++ b/sprout/range/algorithm/cxx14/rotate_copy.hpp @@ -0,0 +1,38 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_ROTATE_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_ROTATE_COPY_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // rotate_copy + // + template< + typename ForwardRange, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + rotate_copy( + ForwardRange const& rng, typename sprout::container_traits::const_iterator middle, + OutputIterator result + ) + { + return sprout::rotate_copy(sprout::begin(rng), middle, sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_ROTATE_COPY_HPP diff --git a/sprout/range/algorithm/cxx14/sample.hpp b/sprout/range/algorithm/cxx14/sample.hpp new file mode 100644 index 00000000..6b5cf13f --- /dev/null +++ b/sprout/range/algorithm/cxx14/sample.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SAMPLE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SAMPLE_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // sample + // + template< + typename PopRange, typename SampleIterator, typename Size, typename URNG, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR SampleIterator + sample(PopRange const& rng, SampleIterator out, Size n, URNG&& g) { + return sprout::sample(sprout::begin(rng), sprout::end(rng), out, n, SPROUT_FORWARD(URNG, g)); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SAMPLE_HPP diff --git a/sprout/range/algorithm/cxx14/set_difference.hpp b/sprout/range/algorithm/cxx14/set_difference.hpp new file mode 100644 index 00000000..773c1fe9 --- /dev/null +++ b/sprout/range/algorithm/cxx14/set_difference.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_DIFFERENCE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SET_DIFFERENCE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // set_difference + // + template< + typename InputRange1, typename InputRange2, typename OutputIterator, typename Compare, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_difference(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result, Compare comp) { + return sprout::set_difference(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result, comp); + } + template< + typename InputRange1, typename InputRange2, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_difference(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result) { + return sprout::set_difference(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_DIFFERENCE_HPP diff --git a/sprout/range/algorithm/cxx14/set_intersection.hpp b/sprout/range/algorithm/cxx14/set_intersection.hpp new file mode 100644 index 00000000..e99a2646 --- /dev/null +++ b/sprout/range/algorithm/cxx14/set_intersection.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_INTERSECTION_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SET_INTERSECTION_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // set_intersection + // + template< + typename InputRange1, typename InputRange2, typename OutputIterator, typename Compare, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_intersection(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result, Compare comp) { + return sprout::set_intersection(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result, comp); + } + template< + typename InputRange1, typename InputRange2, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_intersection(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result) { + return sprout::set_intersection(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_INTERSECTION_HPP diff --git a/sprout/range/algorithm/cxx14/set_symmetric_difference.hpp b/sprout/range/algorithm/cxx14/set_symmetric_difference.hpp new file mode 100644 index 00000000..636b90c3 --- /dev/null +++ b/sprout/range/algorithm/cxx14/set_symmetric_difference.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_SYMMETRIC_DIFFERENCE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SET_SYMMETRIC_DIFFERENCE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // set_symmetric_difference + // + template< + typename InputRange1, typename InputRange2, typename OutputIterator, typename Compare, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_symmetric_difference(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result, Compare comp) { + return sprout::set_symmetric_difference(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result, comp); + } + template< + typename InputRange1, typename InputRange2, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_symmetric_difference(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result) { + return sprout::set_symmetric_difference(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_SYMMETRIC_DIFFERENCE_HPP diff --git a/sprout/range/algorithm/cxx14/set_union.hpp b/sprout/range/algorithm/cxx14/set_union.hpp new file mode 100644 index 00000000..ebaa97e3 --- /dev/null +++ b/sprout/range/algorithm/cxx14/set_union.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_UNION_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SET_UNION_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // set_union + // + template< + typename InputRange1, typename InputRange2, typename OutputIterator, typename Compare, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_union(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result, Compare comp) { + return sprout::set_union(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result, comp); + } + template< + typename InputRange1, typename InputRange2, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + set_union(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result) { + return sprout::set_union(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), sprout::end(rng2), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SET_UNION_HPP diff --git a/sprout/range/algorithm/cxx14/shuffle.hpp b/sprout/range/algorithm/cxx14/shuffle.hpp new file mode 100644 index 00000000..ae0d12ca --- /dev/null +++ b/sprout/range/algorithm/cxx14/shuffle.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SHUFFLE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SHUFFLE_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // shuffle + // + template + inline SPROUT_CXX14_CONSTEXPR void + shuffle(RandomAccessRange&& rng, UniformRandomNumberGenerator&& g) { + sprout::shuffle( + sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), + SPROUT_FORWARD(UniformRandomNumberGenerator, g) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SHUFFLE_HPP diff --git a/sprout/range/algorithm/cxx14/sort.hpp b/sprout/range/algorithm/cxx14/sort.hpp new file mode 100644 index 00000000..219b40f7 --- /dev/null +++ b/sprout/range/algorithm/cxx14/sort.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SORT_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SORT_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // sort + // + template + inline SPROUT_CXX14_CONSTEXPR void + sort(RandomAccessRange&& rng, Compare comp) { + sprout::sort(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + sort(RandomAccessRange&& rng) { + sprout::sort(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SORT_HPP diff --git a/sprout/range/algorithm/cxx14/sort_heap.hpp b/sprout/range/algorithm/cxx14/sort_heap.hpp new file mode 100644 index 00000000..60401105 --- /dev/null +++ b/sprout/range/algorithm/cxx14/sort_heap.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SORT_HEAP_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SORT_HEAP_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // sort_heap + // + template + inline SPROUT_CXX14_CONSTEXPR void + sort_heap(RandomAccessRange&& rng, Compare comp) { + sprout::sort_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + sort_heap(RandomAccessRange&& rng) { + sprout::sort_heap(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SORT_HEAP_HPP diff --git a/sprout/range/algorithm/cxx14/stable_partition.hpp b/sprout/range/algorithm/cxx14/stable_partition.hpp new file mode 100644 index 00000000..9882b05d --- /dev/null +++ b/sprout/range/algorithm/cxx14/stable_partition.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_STABLE_PARTITION_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_STABLE_PARTITION_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // stable_partition + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + stable_partition(BidirectionalRange&& rng, Predicate pred) { + return sprout::range::range_return::pack( + sprout::stable_partition(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng)), pred), + SPROUT_FORWARD(BidirectionalRange, rng) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + stable_partition(BidirectionalRange&& rng, Predicate pred) { + return sprout::range::range_return::pack( + sprout::stable_partition(sprout::begin(SPROUT_FORWARD(BidirectionalRange, rng)), sprout::end(SPROUT_FORWARD(BidirectionalRange, rng)), pred), + SPROUT_FORWARD(BidirectionalRange, rng) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_STABLE_PARTITION_HPP diff --git a/sprout/range/algorithm/cxx14/stable_sort.hpp b/sprout/range/algorithm/cxx14/stable_sort.hpp new file mode 100644 index 00000000..91d82744 --- /dev/null +++ b/sprout/range/algorithm/cxx14/stable_sort.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_STABLE_SORT_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_STABLE_SORT_HPP + +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // stable_sort + // + template + inline SPROUT_CXX14_CONSTEXPR void + stable_sort(RandomAccessRange&& rng, Compare comp) { + sprout::stable_sort(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)), comp); + } + + template + inline SPROUT_CXX14_CONSTEXPR void + stable_sort(RandomAccessRange&& rng) { + sprout::stable_sort(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng))); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_STABLE_SORT_HPP diff --git a/sprout/range/algorithm/cxx14/swap_ranges.hpp b/sprout/range/algorithm/cxx14/swap_ranges.hpp new file mode 100644 index 00000000..c30a7f0b --- /dev/null +++ b/sprout/range/algorithm/cxx14/swap_ranges.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_SWAP_RANGES_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_SWAP_RANGES_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // swap_ranges + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + swap_ranges(ForwardRange1&& rng1, ForwardRange2&& rng2) { + return sprout::range::range_return::pack( + sprout::swap_ranges( + sprout::begin(SPROUT_FORWARD(ForwardRange1, rng1)), sprout::end(SPROUT_FORWARD(ForwardRange1, rng1)), + sprout::begin(SPROUT_FORWARD(ForwardRange2, rng2)) + ), + SPROUT_FORWARD(ForwardRange2, rng2) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + swap_ranges(ForwardRange1&& rng1, ForwardRange2&& rng2) { + return sprout::range::range_return::pack( + sprout::swap_ranges( + sprout::begin(SPROUT_FORWARD(ForwardRange1, rng1)), sprout::end(SPROUT_FORWARD(ForwardRange1, rng1)), + sprout::begin(SPROUT_FORWARD(ForwardRange2, rng2)) + ), + SPROUT_FORWARD(ForwardRange2, rng2) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_SWAP_RANGES_HPP diff --git a/sprout/range/algorithm/cxx14/transform.hpp b/sprout/range/algorithm/cxx14/transform.hpp new file mode 100644 index 00000000..c88f593f --- /dev/null +++ b/sprout/range/algorithm/cxx14/transform.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_TRANSFORM_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_TRANSFORM_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // transform + // + template< + typename InputRange, typename OutputIterator, typename UnaryOperation, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + transform(InputRange const& rng, OutputIterator result, UnaryOperation op) { + return sprout::transform(sprout::begin(rng), sprout::end(rng), result, op); + } + template< + typename InputRange1, typename InputRange2, typename OutputIterator, typename BinaryOperation, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + transform(InputRange1 const& rng1, InputRange2 const& rng2, OutputIterator result, BinaryOperation op) { + return sprout::transform(sprout::begin(rng1), sprout::end(rng1), sprout::begin(rng2), result, op); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_TRANSFORM_HPP diff --git a/sprout/range/algorithm/cxx14/unique.hpp b/sprout/range/algorithm/cxx14/unique.hpp new file mode 100644 index 00000000..fa56bf1a --- /dev/null +++ b/sprout/range/algorithm/cxx14/unique.hpp @@ -0,0 +1,58 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_UNIQUE_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_UNIQUE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // unique + // + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + unique(ForwardRange&& rng) { + return sprout::range::range_return::pack( + sprout::unique(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng))), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + unique(ForwardRange&& rng) { + return sprout::range::range_return::pack( + sprout::unique(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng))), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + unique(ForwardRange&& rng, BinaryPredicate pred) { + return sprout::range::range_return::pack( + sprout::unique(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + template + inline SPROUT_CXX14_CONSTEXPR typename sprout::range::range_return::type + unique(ForwardRange&& rng, BinaryPredicate pred) { + return sprout::range::range_return::pack( + sprout::unique(sprout::begin(SPROUT_FORWARD(ForwardRange, rng)), sprout::end(SPROUT_FORWARD(ForwardRange, rng)), pred), + SPROUT_FORWARD(ForwardRange, rng) + ); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_UNIQUE_HPP diff --git a/sprout/range/algorithm/cxx14/unique_copy.hpp b/sprout/range/algorithm/cxx14/unique_copy.hpp new file mode 100644 index 00000000..d35397bb --- /dev/null +++ b/sprout/range/algorithm/cxx14/unique_copy.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011-2014 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_RANGE_ALGORITHM_CXX14_UNIQUE_COPY_HPP +#define SPROUT_RANGE_ALGORITHM_CXX14_UNIQUE_COPY_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + // + // unique_copy + // + template< + typename InputRange, typename OutputIterator, typename BinaryPredicate, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + unique_copy(InputRange const& rng, OutputIterator result, BinaryPredicate pred) { + return sprout::unique_copy(sprout::begin(rng), sprout::end(rng), result, pred); + } + template< + typename InputRange, typename OutputIterator, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CXX14_CONSTEXPR OutputIterator + unique_copy(InputRange const& rng, OutputIterator result) { + return sprout::unique_copy(sprout::begin(rng), sprout::end(rng), result); + } + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_CXX14_UNIQUE_COPY_HPP diff --git a/sprout/range/algorithm/modifying.hpp b/sprout/range/algorithm/modifying.hpp index a2372828..de79df64 100644 --- a/sprout/range/algorithm/modifying.hpp +++ b/sprout/range/algorithm/modifying.hpp @@ -11,5 +11,6 @@ #include #include #include +#include #endif // #ifndef SPROUT_RANGE_ALGORITHM_MODIFYIING_HPP