From db20f6499178385477017c1db4a43eaa9fe20f12 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sun, 1 Apr 2012 22:15:09 +0900 Subject: [PATCH] porting sscrisk/CEL --- sprout/algorithm.hpp | 4 +- sprout/algorithm/adjacent_find.hpp | 31 +++ sprout/algorithm/all_of.hpp | 19 ++ sprout/algorithm/any_of.hpp | 19 ++ sprout/algorithm/binary_search.hpp | 37 ++++ sprout/algorithm/count.hpp | 21 +++ sprout/algorithm/count_if.hpp | 21 +++ sprout/algorithm/equal.hpp | 37 ++++ sprout/algorithm/equal_range.hpp | 35 ++++ sprout/algorithm/find.hpp | 19 ++ sprout/algorithm/find_end.hpp | 61 ++++++ sprout/algorithm/find_first_of.hpp | 40 ++++ sprout/algorithm/find_if.hpp | 19 ++ sprout/algorithm/find_if_not.hpp | 20 ++ sprout/algorithm/fit/copy.hpp | 6 +- sprout/algorithm/fit/copy_backward.hpp | 6 +- sprout/algorithm/fit/copy_if.hpp | 4 +- sprout/algorithm/fit/copy_n.hpp | 4 +- sprout/algorithm/fit/fill_n.hpp | 4 +- sprout/algorithm/fit/generate_n.hpp | 4 +- sprout/algorithm/fit/make_partial_heap.hpp | 6 +- sprout/algorithm/fit/merge.hpp | 12 +- sprout/algorithm/fit/nth_element.hpp | 6 +- sprout/algorithm/fit/partial_sort.hpp | 6 +- sprout/algorithm/fit/partition.hpp | 4 +- sprout/algorithm/fit/partition_copy.hpp | 8 +- sprout/algorithm/fit/remove.hpp | 4 +- sprout/algorithm/fit/remove_copy.hpp | 6 +- sprout/algorithm/fit/remove_copy_if.hpp | 6 +- sprout/algorithm/fit/remove_if.hpp | 4 +- sprout/algorithm/fit/replace_copy.hpp | 6 +- sprout/algorithm/fit/replace_copy_if.hpp | 6 +- sprout/algorithm/fit/reverse_copy.hpp | 6 +- sprout/algorithm/fit/rotate_copy.hpp | 6 +- sprout/algorithm/fit/set_difference.hpp | 12 +- sprout/algorithm/fit/set_intersection.hpp | 6 +- .../fit/set_symmetric_difference.hpp | 16 +- sprout/algorithm/fit/set_union.hpp | 16 +- sprout/algorithm/fit/stable_partition.hpp | 4 +- .../algorithm/fit/stable_partition_copy.hpp | 4 +- sprout/algorithm/fit/swap_element_copy.hpp | 6 +- sprout/algorithm/fit/transform.hpp | 8 +- sprout/algorithm/fit/unique_copy.hpp | 8 +- sprout/algorithm/fixed/bogo_sort.hpp | 10 +- sprout/algorithm/fixed/bogo_sort_result.hpp | 10 +- sprout/algorithm/fixed/copy.hpp | 4 +- sprout/algorithm/fixed/copy_backward.hpp | 4 +- sprout/algorithm/fixed/make_heap.hpp | 4 +- sprout/algorithm/fixed/make_partial_heap.hpp | 10 +- sprout/algorithm/fixed/merge.hpp | 4 +- sprout/algorithm/fixed/nth_element.hpp | 10 +- sprout/algorithm/fixed/partial_sort.hpp | 10 +- sprout/algorithm/fixed/pop_heap.hpp | 4 +- sprout/algorithm/fixed/push_heap.hpp | 4 +- sprout/algorithm/fixed/replace_copy.hpp | 8 +- sprout/algorithm/fixed/replace_copy_if.hpp | 4 +- sprout/algorithm/fixed/reverse_copy.hpp | 4 +- sprout/algorithm/fixed/rotate_copy.hpp | 8 +- sprout/algorithm/fixed/set_difference.hpp | 4 +- sprout/algorithm/fixed/set_intersection.hpp | 4 +- .../fixed/set_symmetric_difference.hpp | 4 +- sprout/algorithm/fixed/set_union.hpp | 4 +- sprout/algorithm/fixed/shuffle.hpp | 1 - sprout/algorithm/fixed/sort.hpp | 10 +- sprout/algorithm/fixed/sort_heap.hpp | 4 +- sprout/algorithm/fixed/stable_sort.hpp | 2 +- sprout/algorithm/fixed/swap_element_copy.hpp | 4 +- sprout/algorithm/fixed/transform.hpp | 6 +- sprout/algorithm/includes.hpp | 32 ++++ sprout/algorithm/is_heap.hpp | 22 +++ sprout/algorithm/is_heap_until.hpp | 40 ++++ sprout/algorithm/is_partitioned.hpp | 28 +++ sprout/algorithm/is_permutation.hpp | 74 ++++++++ sprout/algorithm/is_sorted.hpp | 22 +++ sprout/algorithm/is_sorted_until.hpp | 28 +++ sprout/algorithm/lexicographical_compare.hpp | 40 ++++ sprout/algorithm/lower_bound.hpp | 33 ++++ sprout/algorithm/max.hpp | 22 +++ sprout/algorithm/max_element.hpp | 39 ++++ sprout/algorithm/min.hpp | 22 +++ sprout/algorithm/min_element.hpp | 39 ++++ sprout/algorithm/minmax.hpp | 23 +++ sprout/algorithm/minmax_element.hpp | 41 ++++ sprout/algorithm/mismatch.hpp | 40 ++++ sprout/algorithm/modifying.hpp | 8 + sprout/algorithm/non_modifying.hpp | 40 ++++ sprout/algorithm/none_of.hpp | 19 ++ sprout/algorithm/partition_point.hpp | 28 +++ sprout/algorithm/search.hpp | 48 +++++ sprout/algorithm/search_n.hpp | 47 +++++ sprout/algorithm/upper_bound.hpp | 33 ++++ sprout/array.hpp | 6 +- sprout/cctype.hpp | 7 + sprout/config.hpp | 16 +- sprout/container/internal_begin_offset.hpp | 4 +- .../internal_begin_offset_backward.hpp | 4 +- sprout/container/internal_end_offset.hpp | 4 +- .../internal_end_offset_backward.hpp | 4 +- sprout/container/size.hpp | 4 +- sprout/cstdlib.hpp | 8 + sprout/cstdlib/abs.hpp | 31 +++ sprout/cstdlib/div.hpp | 82 ++++++++ sprout/cstring.hpp | 18 ++ sprout/cstring/memchr.hpp | 31 +++ sprout/cstring/memcmp.hpp | 29 +++ sprout/cstring/strchr.hpp | 23 +++ sprout/cstring/strcmp.hpp | 20 ++ sprout/cstring/strcoll.hpp | 16 ++ sprout/cstring/strcspn.hpp | 25 +++ sprout/cstring/strlen.hpp | 24 +++ sprout/cstring/strncmp.hpp | 21 +++ sprout/cstring/strpbrk.hpp | 24 +++ sprout/cstring/strrchr.hpp | 23 +++ sprout/cstring/strspn.hpp | 25 +++ sprout/cstring/strstr.hpp | 23 +++ sprout/ctype/ascii.hpp | 2 + sprout/darkroom/lights/point_light.hpp | 4 +- sprout/detail/algorithm.hpp | 177 ------------------ sprout/detail/functional.hpp | 37 ---- sprout/detail/iterator.hpp | 76 -------- sprout/detail/iterator_ext.hpp | 40 ++++ sprout/functional.hpp | 10 + sprout/functional/arithmetic.hpp | 12 ++ sprout/functional/bind1st.hpp | 34 ++++ sprout/functional/bind2nd.hpp | 34 ++++ sprout/functional/comparison.hpp | 12 ++ sprout/functional/dft/dft_element.hpp | 4 +- sprout/functional/dft/fit/dft.hpp | 6 +- sprout/functional/dft/fit/idft.hpp | 6 +- sprout/functional/dft/fixed/dft.hpp | 4 +- sprout/functional/dft/fixed/idft.hpp | 4 +- sprout/functional/dft/idft_element.hpp | 4 +- sprout/functional/divides.hpp | 23 +++ sprout/functional/equal_to.hpp | 23 +++ sprout/functional/greater.hpp | 23 +++ sprout/functional/greater_equal.hpp | 23 +++ sprout/functional/less.hpp | 23 +++ sprout/functional/less_equal.hpp | 23 +++ sprout/functional/minus.hpp | 23 +++ sprout/functional/modulus.hpp | 23 +++ sprout/functional/multiplies.hpp | 23 +++ sprout/functional/negate.hpp | 22 +++ sprout/functional/not_equal_to.hpp | 23 +++ sprout/functional/plus.hpp | 23 +++ sprout/iterator/distance.hpp | 36 ++++ sprout/iterator/index_iterator.hpp | 14 +- sprout/iterator/operation.hpp | 1 + sprout/iterator/value_iterator.hpp | 14 +- sprout/numeric.hpp | 4 +- sprout/numeric/accumulate.hpp | 25 +++ sprout/numeric/fit/adjacent_difference.hpp | 8 +- sprout/numeric/fit/partial_sum.hpp | 8 +- sprout/numeric/inner_product.hpp | 54 ++++++ sprout/numeric/modifying.hpp | 8 + sprout/numeric/non_modifying.hpp | 8 + sprout/operation/fixed/append.hpp | 6 +- sprout/operation/fixed/erase.hpp | 6 +- sprout/operation/fixed/erase_n.hpp | 6 +- sprout/operation/fixed/insert.hpp | 6 +- sprout/operation/fixed/insert_n.hpp | 6 +- sprout/operation/fixed/set.hpp | 6 +- sprout/random/detail/uniform_int_float.hpp | 4 +- sprout/random/xor_combine.hpp | 6 +- sprout/range/algorithm.hpp | 4 +- sprout/range/algorithm/modifying.hpp | 8 + sprout/range/algorithm/non_modifying.hpp | 40 ++++ sprout/range/numeric.hpp | 4 +- sprout/range/numeric/modifying.hpp | 8 + sprout/range/numeric/non_modifying.hpp | 8 + sprout/string.hpp | 16 +- sprout/sub_array.hpp | 20 +- sprout/utility.hpp | 1 + sprout/utility/pair.hpp | 38 ++++ sprout/uuid/string_generator.hpp | 8 +- sprout/uuid/uuid.hpp | 6 +- .../context/parse_context/terminal/string.hpp | 8 +- sprout/weed/detail/bdigits.hpp | 8 +- sprout/weed/detail/digits.hpp | 8 +- sprout/weed/detail/odigits.hpp | 8 +- sprout/weed/detail/xdigits.hpp | 8 +- sprout/weed/parser/string/string.hpp | 12 +- 181 files changed, 2531 insertions(+), 607 deletions(-) create mode 100644 sprout/algorithm/adjacent_find.hpp create mode 100644 sprout/algorithm/all_of.hpp create mode 100644 sprout/algorithm/any_of.hpp create mode 100644 sprout/algorithm/binary_search.hpp create mode 100644 sprout/algorithm/count.hpp create mode 100644 sprout/algorithm/count_if.hpp create mode 100644 sprout/algorithm/equal.hpp create mode 100644 sprout/algorithm/equal_range.hpp create mode 100644 sprout/algorithm/find.hpp create mode 100644 sprout/algorithm/find_end.hpp create mode 100644 sprout/algorithm/find_first_of.hpp create mode 100644 sprout/algorithm/find_if.hpp create mode 100644 sprout/algorithm/find_if_not.hpp create mode 100644 sprout/algorithm/includes.hpp create mode 100644 sprout/algorithm/is_heap.hpp create mode 100644 sprout/algorithm/is_heap_until.hpp create mode 100644 sprout/algorithm/is_partitioned.hpp create mode 100644 sprout/algorithm/is_permutation.hpp create mode 100644 sprout/algorithm/is_sorted.hpp create mode 100644 sprout/algorithm/is_sorted_until.hpp create mode 100644 sprout/algorithm/lexicographical_compare.hpp create mode 100644 sprout/algorithm/lower_bound.hpp create mode 100644 sprout/algorithm/max.hpp create mode 100644 sprout/algorithm/max_element.hpp create mode 100644 sprout/algorithm/min.hpp create mode 100644 sprout/algorithm/min_element.hpp create mode 100644 sprout/algorithm/minmax.hpp create mode 100644 sprout/algorithm/minmax_element.hpp create mode 100644 sprout/algorithm/mismatch.hpp create mode 100644 sprout/algorithm/modifying.hpp create mode 100644 sprout/algorithm/non_modifying.hpp create mode 100644 sprout/algorithm/none_of.hpp create mode 100644 sprout/algorithm/partition_point.hpp create mode 100644 sprout/algorithm/search.hpp create mode 100644 sprout/algorithm/search_n.hpp create mode 100644 sprout/algorithm/upper_bound.hpp create mode 100644 sprout/cctype.hpp create mode 100644 sprout/cstdlib.hpp create mode 100644 sprout/cstdlib/abs.hpp create mode 100644 sprout/cstdlib/div.hpp create mode 100644 sprout/cstring.hpp create mode 100644 sprout/cstring/memchr.hpp create mode 100644 sprout/cstring/memcmp.hpp create mode 100644 sprout/cstring/strchr.hpp create mode 100644 sprout/cstring/strcmp.hpp create mode 100644 sprout/cstring/strcoll.hpp create mode 100644 sprout/cstring/strcspn.hpp create mode 100644 sprout/cstring/strlen.hpp create mode 100644 sprout/cstring/strncmp.hpp create mode 100644 sprout/cstring/strpbrk.hpp create mode 100644 sprout/cstring/strrchr.hpp create mode 100644 sprout/cstring/strspn.hpp create mode 100644 sprout/cstring/strstr.hpp delete mode 100644 sprout/detail/algorithm.hpp delete mode 100644 sprout/detail/functional.hpp delete mode 100644 sprout/detail/iterator.hpp create mode 100644 sprout/detail/iterator_ext.hpp create mode 100644 sprout/functional.hpp create mode 100644 sprout/functional/arithmetic.hpp create mode 100644 sprout/functional/bind1st.hpp create mode 100644 sprout/functional/bind2nd.hpp create mode 100644 sprout/functional/comparison.hpp create mode 100644 sprout/functional/divides.hpp create mode 100644 sprout/functional/equal_to.hpp create mode 100644 sprout/functional/greater.hpp create mode 100644 sprout/functional/greater_equal.hpp create mode 100644 sprout/functional/less.hpp create mode 100644 sprout/functional/less_equal.hpp create mode 100644 sprout/functional/minus.hpp create mode 100644 sprout/functional/modulus.hpp create mode 100644 sprout/functional/multiplies.hpp create mode 100644 sprout/functional/negate.hpp create mode 100644 sprout/functional/not_equal_to.hpp create mode 100644 sprout/functional/plus.hpp create mode 100644 sprout/iterator/distance.hpp create mode 100644 sprout/numeric/accumulate.hpp create mode 100644 sprout/numeric/inner_product.hpp create mode 100644 sprout/numeric/modifying.hpp create mode 100644 sprout/numeric/non_modifying.hpp create mode 100644 sprout/range/algorithm/modifying.hpp create mode 100644 sprout/range/algorithm/non_modifying.hpp create mode 100644 sprout/range/numeric/modifying.hpp create mode 100644 sprout/range/numeric/non_modifying.hpp create mode 100644 sprout/utility/pair.hpp diff --git a/sprout/algorithm.hpp b/sprout/algorithm.hpp index 2259e3ab..44779676 100644 --- a/sprout/algorithm.hpp +++ b/sprout/algorithm.hpp @@ -2,7 +2,7 @@ #define SPROUT_ALGORITHM_HPP #include -#include -#include +#include +#include #endif // #ifndef SPROUT_ALGORITHM_HPP diff --git a/sprout/algorithm/adjacent_find.hpp b/sprout/algorithm/adjacent_find.hpp new file mode 100644 index 00000000..3623db02 --- /dev/null +++ b/sprout/algorithm/adjacent_find.hpp @@ -0,0 +1,31 @@ +#ifndef SPROUT_ALGORITHM_ADJACENT_FIND_HPP +#define SPROUT_ALGORITHM_ADJACENT_FIND_HPP + +#include +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.8 Adjacent find + template + SPROUT_CONSTEXPR ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred) { + return first == last || sprout::next(first) == last ? last + : pred(*first, *(sprout::next(first))) != false ? first + : sprout::adjacent_find(sprout::next(first), last, pred) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last) { + return sprout::adjacent_find( + first, + last, + NS_SSCRISK_CEL_OR_SPROUT::equal_to::value_type>() + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_ADJACENT_FIND_HPP diff --git a/sprout/algorithm/all_of.hpp b/sprout/algorithm/all_of.hpp new file mode 100644 index 00000000..f2ea54b9 --- /dev/null +++ b/sprout/algorithm/all_of.hpp @@ -0,0 +1,19 @@ +#ifndef SPROUT_ALGORITHM_ALL_OF_HPP +#define SPROUT_ALGORITHM_ALL_OF_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.1 All of + template + SPROUT_CONSTEXPR bool all_of(InputIterator first, InputIterator last, Predicate pred) { + return first == last ? true + : pred(*first) == true && sprout::all_of(sprout::next(first), last, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_ALL_OF_HPP diff --git a/sprout/algorithm/any_of.hpp b/sprout/algorithm/any_of.hpp new file mode 100644 index 00000000..fe988d8c --- /dev/null +++ b/sprout/algorithm/any_of.hpp @@ -0,0 +1,19 @@ +#ifndef SPROUT_ALGORITHM_ANY_OF_HPP +#define SPROUT_ALGORITHM_ANY_OF_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.2 Any of + template + SPROUT_CONSTEXPR bool any_of(InputIterator first, InputIterator last, Predicate pred) { + return first == last ? false + : pred(*first) == true || sprout::any_of(sprout::next(first), last, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_ANY_OF_HPP diff --git a/sprout/algorithm/binary_search.hpp b/sprout/algorithm/binary_search.hpp new file mode 100644 index 00000000..590e3aa7 --- /dev/null +++ b/sprout/algorithm/binary_search.hpp @@ -0,0 +1,37 @@ +#ifndef SPROUT_ALGORITHM_BINARY_SEARCH_HPP +#define SPROUT_ALGORITHM_BINARY_SEARCH_HPP + +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.3.4 binary_search + template + SPROUT_CONSTEXPR bool binary_search(ForwardIterator first, ForwardIterator last, T const& value) { + return first == last ? false + : sprout::next(first) == last ? !(*first < value) && !(value < *first) ? true : false + : *(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2) < value + ? sprout::binary_search(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, last, value) + : value < *(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last)) / 2 + ? sprout::binary_search(first, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, value) + : true + ; + } + + template + SPROUT_CONSTEXPR bool binary_search(ForwardIterator first, ForwardIterator last, T const& value, Compare comp) { + return first == last ? false + : sprout::next(first) == last ? !comp(*first, value) && !comp(value, *first) ? true : false + : comp(*(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2), value) + ? sprout::binary_search(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, last, value) + : comp(value, *(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last)) / 2) + ? sprout::binary_search(first, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, value) + : true + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_BINARY_SEARCH_HPP diff --git a/sprout/algorithm/count.hpp b/sprout/algorithm/count.hpp new file mode 100644 index 00000000..131df9c8 --- /dev/null +++ b/sprout/algorithm/count.hpp @@ -0,0 +1,21 @@ +#ifndef SPROUT_ALGORITHM_COUNT_HPP +#define SPROUT_ALGORITHM_COUNT_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.9 Count + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type + count(InputIterator first, InputIterator last, T const& value) { + return first == last ? 0 + : (*first == value ? 1 : 0) + sprout::count(sprout::next(first), last, value) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_COUNT_HPP diff --git a/sprout/algorithm/count_if.hpp b/sprout/algorithm/count_if.hpp new file mode 100644 index 00000000..3f428964 --- /dev/null +++ b/sprout/algorithm/count_if.hpp @@ -0,0 +1,21 @@ +#ifndef SPROUT_ALGORITHM_COUNT_IF_HPP +#define SPROUT_ALGORITHM_COUNT_IF_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.9 Count + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type + count_if(InputIterator first, InputIterator last, Predicate pred) { + return first == last ? 0 + : (pred(*first) != false ? 1 : 0) + sprout::count_if(sprout::next(first), last, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_COUNT_IF_HPP diff --git a/sprout/algorithm/equal.hpp b/sprout/algorithm/equal.hpp new file mode 100644 index 00000000..b083b96d --- /dev/null +++ b/sprout/algorithm/equal.hpp @@ -0,0 +1,37 @@ +#ifndef SPROUT_ALGORITHM_EQUAL_HPP +#define SPROUT_ALGORITHM_EQUAL_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.11 Equal + template + SPROUT_CONSTEXPR bool equal( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2 + ) + { + return first1 == last1 ? true + : *first1 == *first2 && sprout::equal(sprout::next(first1), last1, sprout::next(first2)) + ; + } + + template + SPROUT_CONSTEXPR bool equal( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + BinaryPredicate pred + ) + { + return first1 == last1 ? true + : pred(*first1, *first2) != false && sprout::equal(sprout::next(first1), last1, sprout::next(first2), pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_EQUAL_HPP diff --git a/sprout/algorithm/equal_range.hpp b/sprout/algorithm/equal_range.hpp new file mode 100644 index 00000000..d22dd418 --- /dev/null +++ b/sprout/algorithm/equal_range.hpp @@ -0,0 +1,35 @@ +#ifndef SPROUT_ALGORITHM_EQUAL_RANGE_HPP +#define SPROUT_ALGORITHM_EQUAL_RANGE_HPP + +#include +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.3.3 equal_range + template + SPROUT_CONSTEXPR sprout::pair equal_range( + ForwardIterator first, + ForwardIterator last, + T const& value + ) + { + return {sprout::lower_bound(first, last, value), sprout::upper_bound(first, last, value)}; + } + + template + SPROUT_CONSTEXPR pair equal_range( + ForwardIterator first, + ForwardIterator last, + T const& value, + Compare comp + ) + { + return {sprout::lower_bound(first, last, value, comp), sprout::upper_bound(first, last, value, comp)}; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_EQUAL_RANGE_HPP diff --git a/sprout/algorithm/find.hpp b/sprout/algorithm/find.hpp new file mode 100644 index 00000000..592be7e2 --- /dev/null +++ b/sprout/algorithm/find.hpp @@ -0,0 +1,19 @@ +#ifndef SPROUT_ALGORITHM_FIND_HPP +#define SPROUT_ALGORITHM_FIND_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.5 Find + template + SPROUT_CONSTEXPR InputIterator find(InputIterator first, InputIterator last, T const& value) { + return first == last || *first == value ? first + : sprout::find(sprout::next(first), last, value) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_FIND_HPP diff --git a/sprout/algorithm/find_end.hpp b/sprout/algorithm/find_end.hpp new file mode 100644 index 00000000..0f1a6ed1 --- /dev/null +++ b/sprout/algorithm/find_end.hpp @@ -0,0 +1,61 @@ +#ifndef SPROUT_ALGORITHM_FIND_END_HPP +#define SPROUT_ALGORITHM_FIND_END_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + struct iter_equal_to { + public: + SPROUT_CONSTEXPR bool operator()( + typename std::iterator_traits::value_type const& x, + typename std::iterator_traits::value_type const& y + ) const + { + return x == y; + } + }; + } // namespace detail + + // 25.2.6 Find end + template + SPROUT_CONSTEXPR ForwardIterator1 find_end( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2, + BinaryPredicate pred + ) + { + return first1 == last1 || first2 == last2 ? last1 + : sprout::search(first1, last1, first2, last2, pred) == first1 + && sprout::search(sprout::next(first1), last1, first2, last2, pred) == last1 + ? first1 + : sprout::find_end(sprout::next(first1), last1, first2, last2, pred) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator1 find_end( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2 + ) + { + return sprout::find_end( + first1, + last1, + first2, + last2, + sprout::detail::iter_equal_to() + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_FIND_END_HPP diff --git a/sprout/algorithm/find_first_of.hpp b/sprout/algorithm/find_first_of.hpp new file mode 100644 index 00000000..5b1178ae --- /dev/null +++ b/sprout/algorithm/find_first_of.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_ALGORITHM_FIND_FIRST_OF_HPP +#define SPROUT_ALGORITHM_FIND_FIRST_OF_HPP + +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.7 Find first + template + SPROUT_CONSTEXPR ForwardIterator1 find_first_of( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2, + BinaryPredicate pred + ) + { + return first1 == last1 || sprout::find_if(first2, last2, NS_SSCRISK_CEL_OR_SPROUT::bind2nd(pred, *first1)) != last2 ? first1 + : sprout::find_first_of(sprout::next(first1), last1, first2, last2, pred) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator1 find_first_of( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2 + ) + { + return first1 == last1 || sprout::find(first2, last2, *first1) != last2 ? first1 + : sprout::find_first_of(sprout::next(first1), last1, first2, last2) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_FIND_FIRST_OF_HPP diff --git a/sprout/algorithm/find_if.hpp b/sprout/algorithm/find_if.hpp new file mode 100644 index 00000000..0f64148e --- /dev/null +++ b/sprout/algorithm/find_if.hpp @@ -0,0 +1,19 @@ +#ifndef SPROUT_ALGORITHM_FIND_IF_HPP +#define SPROUT_ALGORITHM_FIND_IF_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.5 Find + template + SPROUT_CONSTEXPR InputIterator find_if(InputIterator first, InputIterator last, Predicate pred) { + return first == last || pred(*first) != false ? first + : sprout::find_if(sprout::next(first), last, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_FIND_IF_HPP diff --git a/sprout/algorithm/find_if_not.hpp b/sprout/algorithm/find_if_not.hpp new file mode 100644 index 00000000..b2c80e1f --- /dev/null +++ b/sprout/algorithm/find_if_not.hpp @@ -0,0 +1,20 @@ +#ifndef SPROUT_ALGORITHM_FIND_IF_NOT_HPP +#define SPROUT_ALGORITHM_FIND_IF_NOT_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.5 Find + template + SPROUT_CONSTEXPR InputIterator find_if_not(InputIterator first, InputIterator last, Predicate pred) + { + return first == last || pred(*first) == false ? first + : sprout::find_if_not(sprout::next(first), last, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_FIND_IF_NOT_HPP diff --git a/sprout/algorithm/fit/copy.hpp b/sprout/algorithm/fit/copy.hpp index da01f294..55f92e4b 100644 --- a/sprout/algorithm/fit/copy.hpp +++ b/sprout/algorithm/fit/copy.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::copy(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/copy_backward.hpp b/sprout/algorithm/fit/copy_backward.hpp index ddd1be98..39ba0c74 100644 --- a/sprout/algorithm/fit/copy_backward.hpp +++ b/sprout/algorithm/fit/copy_backward.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -23,7 +23,7 @@ namespace sprout { { return sprout::sub_copy( sprout::get_internal(sprout::fixed::copy_backward(first, last, result)), - offset - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)), + offset - NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)), offset ); } diff --git a/sprout/algorithm/fit/copy_if.hpp b/sprout/algorithm/fit/copy_if.hpp index 26b9cea7..e898c922 100644 --- a/sprout/algorithm/fit/copy_if.hpp +++ b/sprout/algorithm/fit/copy_if.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::copy_if(first, last, result, pred)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::count_if(first, last, pred), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/copy_n.hpp b/sprout/algorithm/fit/copy_n.hpp index 0bacbe20..761dda5f 100644 --- a/sprout/algorithm/fit/copy_n.hpp +++ b/sprout/algorithm/fit/copy_n.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -23,7 +23,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::copy_n(first, n, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n, sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/fill_n.hpp b/sprout/algorithm/fit/fill_n.hpp index f9312533..4eca82e6 100644 --- a/sprout/algorithm/fit/fill_n.hpp +++ b/sprout/algorithm/fit/fill_n.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -23,7 +23,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::fill_n(cont, n, value)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n, sprout::size(cont)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::size(cont)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/generate_n.hpp b/sprout/algorithm/fit/generate_n.hpp index 6b383886..39faa010 100644 --- a/sprout/algorithm/fit/generate_n.hpp +++ b/sprout/algorithm/fit/generate_n.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::generate_n(cont, n, gen, inits...)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n, sprout::size(cont)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::size(cont)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/make_partial_heap.hpp b/sprout/algorithm/fit/make_partial_heap.hpp index e245b1de..f3962afa 100644 --- a/sprout/algorithm/fit/make_partial_heap.hpp +++ b/sprout/algorithm/fit/make_partial_heap.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -23,7 +23,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::make_partial_heap(cont, middle, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + offset + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } } // namespace detail @@ -51,7 +51,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::make_partial_heap(cont, middle)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + offset + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } } // namespace detail diff --git a/sprout/algorithm/fit/merge.hpp b/sprout/algorithm/fit/merge.hpp index 6810499f..6ab11019 100644 --- a/sprout/algorithm/fit/merge.hpp +++ b/sprout/algorithm/fit/merge.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -27,8 +27,8 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::merge(first1, last1, first2, last2, result, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2), + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2), sprout::size(result) ) ); @@ -64,8 +64,8 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::merge(first1, last1, first2, last2, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2), + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2), sprout::size(result) ) ); diff --git a/sprout/algorithm/fit/nth_element.hpp b/sprout/algorithm/fit/nth_element.hpp index 4473068e..57b6e8b1 100644 --- a/sprout/algorithm/fit/nth_element.hpp +++ b/sprout/algorithm/fit/nth_element.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -23,7 +23,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::nth_element(cont, nth, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth) + 1 + offset + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), nth) + 1 ); } } // namespace detail @@ -51,7 +51,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::nth_element(cont, nth)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth) + 1 + offset + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), nth) + 1 ); } } // namespace detail diff --git a/sprout/algorithm/fit/partial_sort.hpp b/sprout/algorithm/fit/partial_sort.hpp index 9a47abf1..cc9d531b 100644 --- a/sprout/algorithm/fit/partial_sort.hpp +++ b/sprout/algorithm/fit/partial_sort.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -23,7 +23,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::partial_sort(cont, middle, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + offset + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } } // namespace detail @@ -51,7 +51,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::partial_sort(cont, middle)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + offset + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } } // namespace detail diff --git a/sprout/algorithm/fit/partition.hpp b/sprout/algorithm/fit/partition.hpp index 29c5b422..335260ab 100644 --- a/sprout/algorithm/fit/partition.hpp +++ b/sprout/algorithm/fit/partition.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -22,7 +22,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::partition(cont, pred)), offset, - offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(sprout::begin(cont), sprout::end(cont), pred) + offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count_if(sprout::begin(cont), sprout::end(cont), pred) ); } } // namespace detail diff --git a/sprout/algorithm/fit/partition_copy.hpp b/sprout/algorithm/fit/partition_copy.hpp index c85e82f8..32322be4 100644 --- a/sprout/algorithm/fit/partition_copy.hpp +++ b/sprout/algorithm/fit/partition_copy.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -28,8 +28,8 @@ namespace sprout { offset, offset + sprout::detail::count_n_if( first, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result) ), pred diff --git a/sprout/algorithm/fit/remove.hpp b/sprout/algorithm/fit/remove.hpp index 7d333b8f..44d7ec38 100644 --- a/sprout/algorithm/fit/remove.hpp +++ b/sprout/algorithm/fit/remove.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -22,7 +22,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::remove(cont, value)), offset, - offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count(sprout::begin(cont), sprout::end(cont), value) + offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count(sprout::begin(cont), sprout::end(cont), value) ); } } // namespace detail diff --git a/sprout/algorithm/fit/remove_copy.hpp b/sprout/algorithm/fit/remove_copy.hpp index 8cd400eb..d085bacc 100644 --- a/sprout/algorithm/fit/remove_copy.hpp +++ b/sprout/algorithm/fit/remove_copy.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -25,7 +25,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::remove_copy(first, last, result, value)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count(first, last, value), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT::count(first, last, value), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/remove_copy_if.hpp b/sprout/algorithm/fit/remove_copy_if.hpp index 61f033f2..446d3679 100644 --- a/sprout/algorithm/fit/remove_copy_if.hpp +++ b/sprout/algorithm/fit/remove_copy_if.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -25,7 +25,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::remove_copy_if(first, last, result, pred)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT::count_if(first, last, pred), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/remove_if.hpp b/sprout/algorithm/fit/remove_if.hpp index 46096b9b..0614a6a5 100644 --- a/sprout/algorithm/fit/remove_if.hpp +++ b/sprout/algorithm/fit/remove_if.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -22,7 +22,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::remove_if(cont, pred)), offset, - offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(sprout::begin(cont), sprout::end(cont), pred) + offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count_if(sprout::begin(cont), sprout::end(cont), pred) ); } } // namespace detail diff --git a/sprout/algorithm/fit/replace_copy.hpp b/sprout/algorithm/fit/replace_copy.hpp index fcef7aaf..4a1d04ef 100644 --- a/sprout/algorithm/fit/replace_copy.hpp +++ b/sprout/algorithm/fit/replace_copy.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -26,7 +26,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::replace_copy(first, last, result, old_value, new_value)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/replace_copy_if.hpp b/sprout/algorithm/fit/replace_copy_if.hpp index b88ac201..b90b175e 100644 --- a/sprout/algorithm/fit/replace_copy_if.hpp +++ b/sprout/algorithm/fit/replace_copy_if.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -26,7 +26,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::replace_copy_if(first, last, result, pred, new_value)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/reverse_copy.hpp b/sprout/algorithm/fit/reverse_copy.hpp index 0a3fb126..da347831 100644 --- a/sprout/algorithm/fit/reverse_copy.hpp +++ b/sprout/algorithm/fit/reverse_copy.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::reverse_copy(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/rotate_copy.hpp b/sprout/algorithm/fit/rotate_copy.hpp index 22c38585..521f335c 100644 --- a/sprout/algorithm/fit/rotate_copy.hpp +++ b/sprout/algorithm/fit/rotate_copy.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -25,7 +25,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::rotate_copy(first, middle, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/set_difference.hpp b/sprout/algorithm/fit/set_difference.hpp index 220798d8..6a431b09 100644 --- a/sprout/algorithm/fit/set_difference.hpp +++ b/sprout/algorithm/fit/set_difference.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -28,8 +28,8 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_difference(first1, last1, first2, last2, result, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) - sprout::detail::overlap_count_2(first1, last1, first2, last2, comp) , sprout::size(result) @@ -67,8 +67,8 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_difference(first1, last1, first2, last2, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) - sprout::detail::overlap_count_2(first1, last1, first2, last2) , sprout::size(result) diff --git a/sprout/algorithm/fit/set_intersection.hpp b/sprout/algorithm/fit/set_intersection.hpp index 43dacc16..b00471d5 100644 --- a/sprout/algorithm/fit/set_intersection.hpp +++ b/sprout/algorithm/fit/set_intersection.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -27,7 +27,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( + offset + NS_SSCRISK_CEL_OR_SPROUT::min( sprout::detail::overlap_count_2(first1, last1, first2, last2, comp), sprout::size(result) ) @@ -64,7 +64,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( + offset + NS_SSCRISK_CEL_OR_SPROUT::min( sprout::detail::overlap_count_2(first1, last1, first2, last2), sprout::size(result) ) diff --git a/sprout/algorithm/fit/set_symmetric_difference.hpp b/sprout/algorithm/fit/set_symmetric_difference.hpp index 4fafde36..e80083b1 100644 --- a/sprout/algorithm/fit/set_symmetric_difference.hpp +++ b/sprout/algorithm/fit/set_symmetric_difference.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -28,9 +28,9 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) - + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2) + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2, comp) , sprout::size(result) @@ -68,9 +68,9 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) - + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2) + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2) , sprout::size(result) diff --git a/sprout/algorithm/fit/set_union.hpp b/sprout/algorithm/fit/set_union.hpp index a78451e8..a580a476 100644 --- a/sprout/algorithm/fit/set_union.hpp +++ b/sprout/algorithm/fit/set_union.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -28,9 +28,9 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_union(first1, last1, first2, last2, result, comp)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) - + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2) + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - sprout::detail::overlap_count_2(first1, last1, first2, last2, comp) , sprout::size(result) @@ -68,9 +68,9 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::set_union(first1, last1, first2, last2, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) - + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2) + offset + NS_SSCRISK_CEL_OR_SPROUT::min( + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - sprout::detail::overlap_count_2(first1, last1, first2, last2) , sprout::size(result) diff --git a/sprout/algorithm/fit/stable_partition.hpp b/sprout/algorithm/fit/stable_partition.hpp index c9026054..38b3625a 100644 --- a/sprout/algorithm/fit/stable_partition.hpp +++ b/sprout/algorithm/fit/stable_partition.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -22,7 +22,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::stable_partition(cont, pred)), offset, - offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(sprout::begin(cont), sprout::end(cont), pred) + offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count_if(sprout::begin(cont), sprout::end(cont), pred) ); } } // namespace detail diff --git a/sprout/algorithm/fit/stable_partition_copy.hpp b/sprout/algorithm/fit/stable_partition_copy.hpp index 04a9ad21..6bc8c36f 100644 --- a/sprout/algorithm/fit/stable_partition_copy.hpp +++ b/sprout/algorithm/fit/stable_partition_copy.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::stable_partition_copy(first, last, result, pred)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::count_if(first, last, pred), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/swap_element_copy.hpp b/sprout/algorithm/fit/swap_element_copy.hpp index 78a3a244..1c990f6f 100644 --- a/sprout/algorithm/fit/swap_element_copy.hpp +++ b/sprout/algorithm/fit/swap_element_copy.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -26,7 +26,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::swap_element_copy(first, last, result, pos1, pos2)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/transform.hpp b/sprout/algorithm/fit/transform.hpp index 27beaf28..2a91ad05 100644 --- a/sprout/algorithm/fit/transform.hpp +++ b/sprout/algorithm/fit/transform.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -25,7 +25,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::transform(first, last, result, op)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail @@ -57,7 +57,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::transform(first1, last1, first2, result, op)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fit/unique_copy.hpp b/sprout/algorithm/fit/unique_copy.hpp index bcc04b83..b02f90ad 100644 --- a/sprout/algorithm/fit/unique_copy.hpp +++ b/sprout/algorithm/fit/unique_copy.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -25,7 +25,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::unique_copy(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - sprout::detail::overlap_count(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - sprout::detail::overlap_count(first, last), sprout::size(result)) ); } } // namespace detail @@ -55,7 +55,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::unique_copy(first, last, result, pred)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - sprout::detail::overlap_count(first, last, pred), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - sprout::detail::overlap_count(first, last, pred), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/algorithm/fixed/bogo_sort.hpp b/sprout/algorithm/fixed/bogo_sort.hpp index 7bde9017..87a03121 100644 --- a/sprout/algorithm/fixed/bogo_sort.hpp +++ b/sprout/algorithm/fixed/bogo_sort.hpp @@ -9,8 +9,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -21,7 +21,7 @@ namespace sprout { Compare comp ) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::is_sorted( + return NS_SSCRISK_CEL_OR_SPROUT::is_sorted( sprout::begin(sprout::tuples::get<0>(shuffled)), sprout::end(sprout::tuples::get<0>(shuffled)), comp @@ -43,7 +43,7 @@ namespace sprout { Compare comp ) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::is_sorted( + return NS_SSCRISK_CEL_OR_SPROUT::is_sorted( sprout::begin(cont), sprout::end(cont), comp @@ -87,7 +87,7 @@ namespace sprout { return sprout::fixed::detail::bogo_sort_impl( cont, sprout::forward(g), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>() + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/bogo_sort_result.hpp b/sprout/algorithm/fixed/bogo_sort_result.hpp index 1c233655..9378e8da 100644 --- a/sprout/algorithm/fixed/bogo_sort_result.hpp +++ b/sprout/algorithm/fixed/bogo_sort_result.hpp @@ -10,8 +10,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -25,7 +25,7 @@ namespace sprout { Compare comp ) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::is_sorted( + return NS_SSCRISK_CEL_OR_SPROUT::is_sorted( sprout::begin(sprout::tuples::get<0>(shuffled)), sprout::end(sprout::tuples::get<0>(shuffled)), comp @@ -54,7 +54,7 @@ namespace sprout { typename sprout::fixed::result_of::algorithm::type, typename std::decay::type > result_type; - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::is_sorted( + return NS_SSCRISK_CEL_OR_SPROUT::is_sorted( sprout::begin(cont), sprout::end(cont), comp @@ -107,7 +107,7 @@ namespace sprout { return sprout::fixed::detail::bogo_sort_result_impl( cont, sprout::forward(g), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>() + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/copy.hpp b/sprout/algorithm/fixed/copy.hpp index d34f531e..13d947c3 100644 --- a/sprout/algorithm/fixed/copy.hpp +++ b/sprout/algorithm/fixed/copy.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -50,7 +50,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/copy_backward.hpp b/sprout/algorithm/fixed/copy_backward.hpp index 87302356..8e316f58 100644 --- a/sprout/algorithm/fixed/copy_backward.hpp +++ b/sprout/algorithm/fixed/copy_backward.hpp @@ -11,7 +11,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -51,7 +51,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_end_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/make_heap.hpp b/sprout/algorithm/fixed/make_heap.hpp index 1f6eb674..f0e13473 100644 --- a/sprout/algorithm/fixed/make_heap.hpp +++ b/sprout/algorithm/fixed/make_heap.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -133,7 +133,7 @@ namespace sprout { { return sprout::fixed::detail::make_heap_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont) ); diff --git a/sprout/algorithm/fixed/make_partial_heap.hpp b/sprout/algorithm/fixed/make_partial_heap.hpp index 758f991b..2a174b5a 100644 --- a/sprout/algorithm/fixed/make_partial_heap.hpp +++ b/sprout/algorithm/fixed/make_partial_heap.hpp @@ -9,8 +9,8 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -82,7 +82,7 @@ namespace sprout { comp, sprout::internal_begin_offset(cont), sprout::size(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } // @@ -96,10 +96,10 @@ namespace sprout { { return sprout::fixed::detail::make_partial_heap_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/merge.hpp b/sprout/algorithm/fixed/merge.hpp index 67295206..3fc4a7a9 100644 --- a/sprout/algorithm/fixed/merge.hpp +++ b/sprout/algorithm/fixed/merge.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -100,7 +100,7 @@ namespace sprout { first2, last2, result, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::size(result) ); } diff --git a/sprout/algorithm/fixed/nth_element.hpp b/sprout/algorithm/fixed/nth_element.hpp index 36db22c2..5dfebf08 100644 --- a/sprout/algorithm/fixed/nth_element.hpp +++ b/sprout/algorithm/fixed/nth_element.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -58,7 +58,7 @@ namespace sprout { comp, sprout::internal_begin_offset(cont), sprout::size(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), nth) ); } // @@ -72,10 +72,10 @@ namespace sprout { { return sprout::fixed::detail::nth_element_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), nth) ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/partial_sort.hpp b/sprout/algorithm/fixed/partial_sort.hpp index 5b997475..757e0b1b 100644 --- a/sprout/algorithm/fixed/partial_sort.hpp +++ b/sprout/algorithm/fixed/partial_sort.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -45,7 +45,7 @@ namespace sprout { comp, sprout::internal_begin_offset(cont), sprout::size(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } // @@ -59,10 +59,10 @@ namespace sprout { { return sprout::fixed::detail::partial_sort_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), middle) ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/pop_heap.hpp b/sprout/algorithm/fixed/pop_heap.hpp index 91d01156..a85b6129 100644 --- a/sprout/algorithm/fixed/pop_heap.hpp +++ b/sprout/algorithm/fixed/pop_heap.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -85,7 +85,7 @@ namespace sprout { { return sprout::fixed::detail::pop_heap_impl( sprout::fixed::swap_element(cont, sprout::begin(cont), sprout::end(cont) - 1), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont) - 1 ); diff --git a/sprout/algorithm/fixed/push_heap.hpp b/sprout/algorithm/fixed/push_heap.hpp index 3ff59c8e..0667c59c 100644 --- a/sprout/algorithm/fixed/push_heap.hpp +++ b/sprout/algorithm/fixed/push_heap.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -61,7 +61,7 @@ namespace sprout { { return sprout::fixed::detail::push_heap_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont) - 1 ); diff --git a/sprout/algorithm/fixed/replace_copy.hpp b/sprout/algorithm/fixed/replace_copy.hpp index ce21c63e..ed3858e0 100644 --- a/sprout/algorithm/fixed/replace_copy.hpp +++ b/sprout/algorithm/fixed/replace_copy.hpp @@ -10,8 +10,8 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -33,7 +33,7 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal_to()(*sprout::next(first, Indexes - offset), old_value) ? new_value : *sprout::next(first, Indexes - offset) + ? NS_SSCRISK_CEL_OR_SPROUT::equal_to()(*sprout::next(first, Indexes - offset), old_value) ? new_value : *sprout::next(first, Indexes - offset) : *sprout::next(sprout::internal_begin(result), Indexes) )... ); @@ -57,7 +57,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/replace_copy_if.hpp b/sprout/algorithm/fixed/replace_copy_if.hpp index abad49fc..f2d36800 100644 --- a/sprout/algorithm/fixed/replace_copy_if.hpp +++ b/sprout/algorithm/fixed/replace_copy_if.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -56,7 +56,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/reverse_copy.hpp b/sprout/algorithm/fixed/reverse_copy.hpp index 18d5be96..e94fd163 100644 --- a/sprout/algorithm/fixed/reverse_copy.hpp +++ b/sprout/algorithm/fixed/reverse_copy.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -50,7 +50,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/rotate_copy.hpp b/sprout/algorithm/fixed/rotate_copy.hpp index 892c1f0a..1fa007b4 100644 --- a/sprout/algorithm/fixed/rotate_copy.hpp +++ b/sprout/algorithm/fixed/rotate_copy.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -31,9 +31,9 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? (Indexes < offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(middle, last) + ? (Indexes < offset + NS_SSCRISK_CEL_OR_SPROUT::distance(middle, last) ? *sprout::next(middle, Indexes - offset) - : *sprout::prev(sprout::next(first, Indexes - offset), NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, middle)) + : *sprout::prev(sprout::next(first, Indexes - offset), NS_SSCRISK_CEL_OR_SPROUT::distance(first, middle)) ) : *sprout::next(sprout::internal_begin(result), Indexes) )... @@ -56,7 +56,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/set_difference.hpp b/sprout/algorithm/fixed/set_difference.hpp index 6200eb95..30ffe5cf 100644 --- a/sprout/algorithm/fixed/set_difference.hpp +++ b/sprout/algorithm/fixed/set_difference.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -102,7 +102,7 @@ namespace sprout { first2, last2, result, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::size(result) ); } diff --git a/sprout/algorithm/fixed/set_intersection.hpp b/sprout/algorithm/fixed/set_intersection.hpp index 255ad774..90f29a77 100644 --- a/sprout/algorithm/fixed/set_intersection.hpp +++ b/sprout/algorithm/fixed/set_intersection.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -102,7 +102,7 @@ namespace sprout { first2, last2, result, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::size(result) ); } diff --git a/sprout/algorithm/fixed/set_symmetric_difference.hpp b/sprout/algorithm/fixed/set_symmetric_difference.hpp index 03c8ab39..cccc7b75 100644 --- a/sprout/algorithm/fixed/set_symmetric_difference.hpp +++ b/sprout/algorithm/fixed/set_symmetric_difference.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -102,7 +102,7 @@ namespace sprout { first2, last2, result, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::size(result) ); } diff --git a/sprout/algorithm/fixed/set_union.hpp b/sprout/algorithm/fixed/set_union.hpp index 4286cca0..48abd367 100644 --- a/sprout/algorithm/fixed/set_union.hpp +++ b/sprout/algorithm/fixed/set_union.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -102,7 +102,7 @@ namespace sprout { first2, last2, result, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::size(result) ); } diff --git a/sprout/algorithm/fixed/shuffle.hpp b/sprout/algorithm/fixed/shuffle.hpp index 55006699..83814588 100644 --- a/sprout/algorithm/fixed/shuffle.hpp +++ b/sprout/algorithm/fixed/shuffle.hpp @@ -43,7 +43,6 @@ namespace sprout { UniformRandomNumberGenerator&& g ) { - return n > 0 ? sprout::fixed::detail::make_shuffle_indexes_1( n, diff --git a/sprout/algorithm/fixed/sort.hpp b/sprout/algorithm/fixed/sort.hpp index e17f7e91..a97df033 100644 --- a/sprout/algorithm/fixed/sort.hpp +++ b/sprout/algorithm/fixed/sort.hpp @@ -8,8 +8,8 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -206,7 +206,7 @@ namespace sprout { return sprout::fixed::detail::sort_start( cont, sprout::internal_begin_offset(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::end(cont) - 1), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::end(cont) - 1), comp ); } @@ -231,8 +231,8 @@ namespace sprout { return sprout::fixed::detail::sort_start( cont, sprout::internal_begin_offset(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::end(cont) - 1), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>() + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::end(cont) - 1), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>() ); } } // namespace detail diff --git a/sprout/algorithm/fixed/sort_heap.hpp b/sprout/algorithm/fixed/sort_heap.hpp index 40f23282..e12e75c0 100644 --- a/sprout/algorithm/fixed/sort_heap.hpp +++ b/sprout/algorithm/fixed/sort_heap.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -63,7 +63,7 @@ namespace sprout { { return sprout::fixed::detail::sort_heap_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::internal_begin_offset(cont), sprout::size(cont) ); diff --git a/sprout/algorithm/fixed/stable_sort.hpp b/sprout/algorithm/fixed/stable_sort.hpp index ecea99c3..cb4e2221 100644 --- a/sprout/algorithm/fixed/stable_sort.hpp +++ b/sprout/algorithm/fixed/stable_sort.hpp @@ -194,7 +194,7 @@ namespace sprout { { return sprout::fixed::detail::stable_sort_impl( cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::less::value_type>(), sprout::size(cont) ); } diff --git a/sprout/algorithm/fixed/swap_element_copy.hpp b/sprout/algorithm/fixed/swap_element_copy.hpp index 678b8bdd..aa2e828c 100644 --- a/sprout/algorithm/fixed/swap_element_copy.hpp +++ b/sprout/algorithm/fixed/swap_element_copy.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -60,7 +60,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template diff --git a/sprout/algorithm/fixed/transform.hpp b/sprout/algorithm/fixed/transform.hpp index 39513a02..46d26bae 100644 --- a/sprout/algorithm/fixed/transform.hpp +++ b/sprout/algorithm/fixed/transform.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -53,7 +53,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } template @@ -158,7 +158,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) ); } template diff --git a/sprout/algorithm/includes.hpp b/sprout/algorithm/includes.hpp new file mode 100644 index 00000000..5d08a86e --- /dev/null +++ b/sprout/algorithm/includes.hpp @@ -0,0 +1,32 @@ +#ifndef SPROUT_ALGORITHM_INCLUDES_HPP +#define SPROUT_ALGORITHM_INCLUDES_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.5.1 includes + template + SPROUT_CONSTEXPR bool includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) { + return first2 == last2 ? true + : first1 == last1 ? false + : !(*first1 < *first2) && !(*first2 < *first1) + ? sprout::includes(sprout::next(first1), last1, sprout::next(first2), last2) + : sprout::includes(sprout::next(first1), last1, first2, last2) + ; + } + + template + SPROUT_CONSTEXPR bool includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp) { + return first2 == last2 ? true + : first1 == last1 ? false + : !comp(*first1, *first2) && !comp(*first2, *first1) + ? sprout::includes(sprout::next(first1), last1, sprout::next(first2), last2) + : sprout::includes(sprout::next(first1), last1, first2, last2) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_INCLUDES_HPP diff --git a/sprout/algorithm/is_heap.hpp b/sprout/algorithm/is_heap.hpp new file mode 100644 index 00000000..5424599e --- /dev/null +++ b/sprout/algorithm/is_heap.hpp @@ -0,0 +1,22 @@ +#ifndef SPROUT_ALGORITHM_IS_HEAP_HPP +#define SPROUT_ALGORITHM_IS_HEAP_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.6.5 is_heap + template + SPROUT_CONSTEXPR bool is_heap(RandomAccessIterator first, RandomAccessIterator last) { + return sprout::is_heap_until(first, last) == last; + } + + template + SPROUT_CONSTEXPR bool is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp) { + return sprout::is_heap_until(first, last, comp) == last; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_IS_HEAP_HPP diff --git a/sprout/algorithm/is_heap_until.hpp b/sprout/algorithm/is_heap_until.hpp new file mode 100644 index 00000000..5056d5a6 --- /dev/null +++ b/sprout/algorithm/is_heap_until.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_ALGORITHM_IS_HEAP_UNTIL_HPP +#define SPROUT_ALGORITHM_IS_HEAP_UNTIL_HPP + +#include +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR RandomAccessIterator is_heap_until_impl( + RandomAccessIterator first, + RandomAccessIterator last, + Compare comp, + std::size_t n + ) + { + return first + n == last || !comp(first[n], first[(n - 1) / 2]) ? first + n + : sprout::detail::is_heap_until_impl(first, last, comp, n + 1) + ; + } + } // namespace detail + + // 25.4.6.5 is_heap + template + SPROUT_CONSTEXPR RandomAccessIterator is_heap_until(RandomAccessIterator first, RandomAccessIterator last) { + return sprout::is_heap_until(first, last, NS_SSCRISK_CEL_OR_SPROUT::less()); + } + + template + SPROUT_CONSTEXPR RandomAccessIterator is_heap_until(RandomAccessIterator first, RandomAccessIterator last, Compare comp) { + return NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) < 2 ? last : sprout::detail::is_heap_until_impl(first, last, comp, 1); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_IS_HEAP_UNTIL_HPP diff --git a/sprout/algorithm/is_partitioned.hpp b/sprout/algorithm/is_partitioned.hpp new file mode 100644 index 00000000..2dbed643 --- /dev/null +++ b/sprout/algorithm/is_partitioned.hpp @@ -0,0 +1,28 @@ +#ifndef SPROUT_ALGORITHM_IS_PARTITIONED_HPP +#define SPROUT_ALGORITHM_IS_PARTITIONED_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR bool is_partitioned_impl(InputIterator first, InputIterator last, Predicate pred, bool cond = true) { + return first == last ? true + : cond ? sprout::detail::is_partitioned_impl(sprout::next(first), last, pred, pred(*first)) + : pred(*first) ? false + : sprout::detail::is_partitioned_impl(sprout::next(first), last, pred, false) + ; + } + } // namespace detail + + // 25.3.13 Partitions + template + SPROUT_CONSTEXPR bool is_partitioned(InputIterator first, InputIterator last, Predicate pred) { + return sprout::detail::is_partitioned_impl(first, last, pred); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_IS_PARTITIONED_HPP diff --git a/sprout/algorithm/is_permutation.hpp b/sprout/algorithm/is_permutation.hpp new file mode 100644 index 00000000..087515d9 --- /dev/null +++ b/sprout/algorithm/is_permutation.hpp @@ -0,0 +1,74 @@ +#ifndef SPROUT_ALGORITHM_IS_PERMUTATION_HPP +#define SPROUT_ALGORITHM_IS_PERMUTATION_HPP + +#include +#include +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR bool is_permutation_impl( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator1 first1_ + ) + { + return first1_ == last1 ? true + : sprout::count(first1, last1, *first1_) + == sprout::count(first2, first2 + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1), *first1_) + && sprout::detail::is_permutation_impl(first1, last1, first2, sprout::next(first1_)) + ? true + : false + ; + } + + template + SPROUT_CONSTEXPR bool is_permutation_impl( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator1 first1_, + BinaryPredicate pred + ) + { + return first1_ == last1 ? true + : sprout::count_if(first1, last1, NS_SSCRISK_CEL_OR_SPROUT::bind2nd(pred, *first1_)) + == sprout::count_if(first2, first2 + NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1), NS_SSCRISK_CEL_OR_SPROUT::bind2nd(pred, *first1_)) + && sprout::detail::is_permutation_impl(first1, last1, first2, sprout::next(first1_), pred) + ? true + : false + ; + } + } // namespace detail + + // 25.2.12 Is permutation + template + SPROUT_CONSTEXPR bool is_permutation( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2 + ) + { + return sprout::detail::is_permutation_impl(first1, last1, first2, first1); + } + + template + SPROUT_CONSTEXPR bool is_permutation( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + BinaryPredicate pred + ) + { + return sprout::detail::is_permutation_impl(first1, last1, first2, first1, pred); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_IS_PERMUTATION_HPP diff --git a/sprout/algorithm/is_sorted.hpp b/sprout/algorithm/is_sorted.hpp new file mode 100644 index 00000000..be9390a2 --- /dev/null +++ b/sprout/algorithm/is_sorted.hpp @@ -0,0 +1,22 @@ +#ifndef SPROUT_ALGORITHM_IS_SORTED_HPP +#define SPROUT_ALGORITHM_IS_SORTED_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.1.5 is_sorted + template + SPROUT_CONSTEXPR bool is_sorted(ForwardIterator first, ForwardIterator last) { + return sprout::is_sorted_until(first, last) == last; + } + + template + SPROUT_CONSTEXPR bool is_sorted(ForwardIterator first, ForwardIterator last, Compare comp) { + return sprout::is_sorted_until(first, last, comp) == last; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_IS_SORTED_HPP diff --git a/sprout/algorithm/is_sorted_until.hpp b/sprout/algorithm/is_sorted_until.hpp new file mode 100644 index 00000000..3eabc7ad --- /dev/null +++ b/sprout/algorithm/is_sorted_until.hpp @@ -0,0 +1,28 @@ +#ifndef SPROUT_ALGORITHM_IS_SORTED_UNTIL_HPP +#define SPROUT_ALGORITHM_IS_SORTED_UNTIL_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.1.5 is_sorted + template + SPROUT_CONSTEXPR ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator last) { + return first == last || sprout::next(first) == last ? last + : *(sprout::next(first)) < *first ? sprout::next(first) + : sprout::is_sorted_until(sprout::next(first), last) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp) { + return first == last || sprout::next(first) == last ? last + : comp(*(sprout::next(first)), *first) != false ? sprout::next(first) + : sprout::is_sorted_until(sprout::next(first), last) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_IS_SORTED_UNTIL_HPP diff --git a/sprout/algorithm/lexicographical_compare.hpp b/sprout/algorithm/lexicographical_compare.hpp new file mode 100644 index 00000000..bb7c84b0 --- /dev/null +++ b/sprout/algorithm/lexicographical_compare.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_ALGORITHM_LEXICOGRAPHICAL_COMPARE_HPP +#define SPROUT_ALGORITHM_LEXICOGRAPHICAL_COMPARE_HPP + +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.8 Lexicographical comparison + template + SPROUT_CONSTEXPR bool lexicographical_compare( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + Compare comp + ) + { + return first2 == last2 ? false + : first1 == last1 || comp(*first1, *first2) ? true + : comp(*first2, *first1) ? false + : sprout::lexicographical_compare(sprout::next(first1), last1, sprout::next(first2), last2, comp) + ; + } + + template + SPROUT_CONSTEXPR bool lexicographical_compare( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2 + ) + { + return sprout::lexicographical_compare(first1, last1, first2, last2, NS_SSCRISK_CEL_OR_SPROUT::less()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_LEXICOGRAPHICAL_COMPARE_HPP diff --git a/sprout/algorithm/lower_bound.hpp b/sprout/algorithm/lower_bound.hpp new file mode 100644 index 00000000..0497a1ea --- /dev/null +++ b/sprout/algorithm/lower_bound.hpp @@ -0,0 +1,33 @@ +#ifndef SPROUT_ALGORITHM_LOWER_BOUND_HPP +#define SPROUT_ALGORITHM_LOWER_BOUND_HPP + +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.3.1 lower_bound + template + SPROUT_CONSTEXPR ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, T const& value) { + return first == last ? last + : sprout::next(first) == last ? *first < value ? last : first + : *(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2) < value + ? sprout::lower_bound(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, last, value) + : sprout::lower_bound(first, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, value) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, T const& value, Compare comp) { + return first == last ? last + : sprout::next(first) == last ? comp(*first, value) ? last : first + : comp(*(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2), value) + ? sprout::lower_bound(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, last, value, comp) + : sprout::lower_bound(first, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, value, comp) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_LOWER_BOUND_HPP diff --git a/sprout/algorithm/max.hpp b/sprout/algorithm/max.hpp new file mode 100644 index 00000000..3751ddad --- /dev/null +++ b/sprout/algorithm/max.hpp @@ -0,0 +1,22 @@ +#ifndef SPROUT_ALGORITHM_MAX_HPP +#define SPROUT_ALGORITHM_MAX_HPP + +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.7 Minimum and maximum + template + SPROUT_CONSTEXPR T const& max(T const& a, T const& b, Compare comp) { + return comp(a, b) ? b : a; + } + + template + SPROUT_CONSTEXPR T const& max(T const& a, T const& b) { + return sprout::max(a, b, NS_SSCRISK_CEL_OR_SPROUT::less()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MAX_HPP diff --git a/sprout/algorithm/max_element.hpp b/sprout/algorithm/max_element.hpp new file mode 100644 index 00000000..38b65110 --- /dev/null +++ b/sprout/algorithm/max_element.hpp @@ -0,0 +1,39 @@ +#ifndef SPROUT_ALGORITHM_MAX_ELEMENT_HPP +#define SPROUT_ALGORITHM_MAX_ELEMENT_HPP + +#include +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR ForwardIterator max_element_impl( + ForwardIterator first, + ForwardIterator last, + Compare comp, + ForwardIterator max + ) + { + return first == last ? max + : sprout::detail::max_element_impl(sprout::next(first), last, comp, comp(*max, *first) ? first : max) + ; + } + } // namespace detail + + // 25.4.7 Minimum and maximum + template + SPROUT_CONSTEXPR ForwardIterator max_element(ForwardIterator first, ForwardIterator last, Compare comp) { + return sprout::detail::max_element_impl(first, last, comp, first); + } + + template + SPROUT_CONSTEXPR ForwardIterator max_element(ForwardIterator first, ForwardIterator last) { + return sprout::max_element(first, last, NS_SSCRISK_CEL_OR_SPROUT::less::value_type>()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MAX_ELEMENT_HPP diff --git a/sprout/algorithm/min.hpp b/sprout/algorithm/min.hpp new file mode 100644 index 00000000..62acb63c --- /dev/null +++ b/sprout/algorithm/min.hpp @@ -0,0 +1,22 @@ +#ifndef SPROUT_ALGORITHM_MIN_HPP +#define SPROUT_ALGORITHM_MIN_HPP + +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.7 Minimum and maximum + template + SPROUT_CONSTEXPR T const& min(T const& a, T const& b, Compare comp) { + return comp(b, a) ? b : a; + } + + template + SPROUT_CONSTEXPR T const& min(T const& a, T const& b) { + return sprout::min(a, b, NS_SSCRISK_CEL_OR_SPROUT::less()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MIN_HPP diff --git a/sprout/algorithm/min_element.hpp b/sprout/algorithm/min_element.hpp new file mode 100644 index 00000000..b9673998 --- /dev/null +++ b/sprout/algorithm/min_element.hpp @@ -0,0 +1,39 @@ +#ifndef SPROUT_ALGORITHM_MIN_ELEMENT_HPP +#define SPROUT_ALGORITHM_MIN_ELEMENT_HPP + +#include +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR ForwardIterator min_element_impl( + ForwardIterator first, + ForwardIterator last, + Compare comp, + ForwardIterator min + ) + { + return first == last ? min + : sprout::detail::min_element_impl(sprout::next(first), last, comp, comp(*first, *min) ? first : min) + ; + } + } // namespace detail + + // 25.4.7 Minimum and maximum + template + SPROUT_CONSTEXPR ForwardIterator min_element(ForwardIterator first, ForwardIterator last, Compare comp) { + return sprout::detail::min_element_impl(first, last, comp, first); + } + + template + SPROUT_CONSTEXPR ForwardIterator min_element(ForwardIterator first, ForwardIterator last) { + return sprout::min_element(first, last, NS_SSCRISK_CEL_OR_SPROUT::less::value_type>()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MIN_ELEMENT_HPP diff --git a/sprout/algorithm/minmax.hpp b/sprout/algorithm/minmax.hpp new file mode 100644 index 00000000..f304ab9e --- /dev/null +++ b/sprout/algorithm/minmax.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_ALGORITHM_MINMAX_HPP +#define SPROUT_ALGORITHM_MINMAX_HPP + +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.7 Minimum and maximum + template + SPROUT_CONSTEXPR sprout::pair minmax(T const& a, T const& b, Compare comp) { + return comp(b, a) ? sprout::pair(b, a) : sprout::pair(a, b); + } + + template + SPROUT_CONSTEXPR sprout::pair minmax(T const& a, T const& b) { + return sprout::minmax(a, b, NS_SSCRISK_CEL_OR_SPROUT::less()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MINMAX_HPP diff --git a/sprout/algorithm/minmax_element.hpp b/sprout/algorithm/minmax_element.hpp new file mode 100644 index 00000000..9a745457 --- /dev/null +++ b/sprout/algorithm/minmax_element.hpp @@ -0,0 +1,41 @@ +#ifndef SPROUT_ALGORITHM_MINMAX_ELEMENT_HPP +#define SPROUT_ALGORITHM_MINMAX_ELEMENT_HPP + +#include +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR sprout::pair minmax_element_impl( + ForwardIterator first, + ForwardIterator last, + Compare comp, + ForwardIterator min, + ForwardIterator max + ) + { + return first == last ? sprout::pair(min, max) + : comp(*first, *min) ? sprout::detail::minmax_element_impl(sprout::next(first), last, comp, first, max) + : sprout::detail::minmax_element_impl(sprout::next(first), last, comp, min, comp(*first, *max) ? max : first) + ; + } + } // namespace detail + + // 25.4.7 Minimum and maximum + template + SPROUT_CONSTEXPR pair minmax_element(ForwardIterator first, ForwardIterator last, Compare comp) { + return sprout::detail::minmax_element_impl(first, last, comp, first, first); + } + + template + SPROUT_CONSTEXPR pair minmax_element(ForwardIterator first, ForwardIterator last) { + return sprout::minmax_element(first, last, NS_SSCRISK_CEL_OR_SPROUT::less::value_type>()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MINMAX_ELEMENT_HPP diff --git a/sprout/algorithm/mismatch.hpp b/sprout/algorithm/mismatch.hpp new file mode 100644 index 00000000..52f157a5 --- /dev/null +++ b/sprout/algorithm/mismatch.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_ALGORITHM_MISMATCH_HPP +#define SPROUT_ALGORITHM_MISMATCH_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.10 Mismatch + template + SPROUT_CONSTEXPR sprout::pair mismatch( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2 + ) + { + return first1 == last1 || !(*first1 == *first2) + ? sprout::pair{first1, first2} + : sprout::mismatch(sprout::next(first1), last1, sprout::next(first2)) + ; + } + + template + SPROUT_CONSTEXPR sprout::pair mismatch( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + BinaryPredicate pred + ) + { + return first1 == last1 || pred(*first1, *first2) == false + ? sprout::pair{first1, first2} + : sprout::mismatch(sprout::next(first1), last1, sprout::next(first2)) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_MISMATCH_HPP diff --git a/sprout/algorithm/modifying.hpp b/sprout/algorithm/modifying.hpp new file mode 100644 index 00000000..3ef59e3c --- /dev/null +++ b/sprout/algorithm/modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_ALGORITHM_MODIFYIING_HPP +#define SPROUT_ALGORITHM_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_ALGORITHM_MODIFYIING_HPP diff --git a/sprout/algorithm/non_modifying.hpp b/sprout/algorithm/non_modifying.hpp new file mode 100644 index 00000000..322192a4 --- /dev/null +++ b/sprout/algorithm/non_modifying.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_ALGORITHM_NON_MODIFYIING_HPP +#define SPROUT_ALGORITHM_NON_MODIFYIING_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 + +#endif // #ifndef SPROUT_ALGORITHM_NON_MODIFYIING_HPP diff --git a/sprout/algorithm/none_of.hpp b/sprout/algorithm/none_of.hpp new file mode 100644 index 00000000..6966b1c6 --- /dev/null +++ b/sprout/algorithm/none_of.hpp @@ -0,0 +1,19 @@ +#ifndef SPROUT_ALGORITHM_NONE_OF_HPP +#define SPROUT_ALGORITHM_NONE_OF_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.3 None of + template + SPROUT_CONSTEXPR bool none_of(InputIterator first, InputIterator last, Predicate pred) { + return first == last ? true + : pred(*first) == false && sprout::none_of(sprout::next(first), last, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_NONE_OF_HPP diff --git a/sprout/algorithm/partition_point.hpp b/sprout/algorithm/partition_point.hpp new file mode 100644 index 00000000..96ed7224 --- /dev/null +++ b/sprout/algorithm/partition_point.hpp @@ -0,0 +1,28 @@ +#ifndef SPROUT_ALGORITHM_PARTITION_POINT_HPP +#define SPROUT_ALGORITHM_PARTITION_POINT_HPP + +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + template + SPROUT_CONSTEXPR ForwardIterator partition_point_impl(ForwardIterator first, ForwardIterator last, Predicate pred, ForwardIterator mid) { + return mid == last ? mid + : pred(*mid) ? sprout::detail::partition_point_impl(mid + 1, last, pred, mid + 1 + NS_SSCRISK_CEL_OR_SPROUT::distance(mid + 1, last) / 2) + : sprout::detail::partition_point_impl(first, mid, pred, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, mid) / 2) + ; + } + } // namespace detail + + // 25.3.13 Partitions + template + SPROUT_CONSTEXPR ForwardIterator partition_point(ForwardIterator first, ForwardIterator last, Predicate pred) { + return sprout::detail::partition_point_impl(first, last, pred, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_PARTITION_POINT_HPP diff --git a/sprout/algorithm/search.hpp b/sprout/algorithm/search.hpp new file mode 100644 index 00000000..2089b845 --- /dev/null +++ b/sprout/algorithm/search.hpp @@ -0,0 +1,48 @@ +#ifndef SPROUT_ALGORITHM_SEARCH_HPP +#define SPROUT_ALGORITHM_SEARCH_HPP + +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.13 Search + template + SPROUT_CONSTEXPR ForwardIterator1 search( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2 + ) + { + return first1 == last1 || first2 == last2 ? first1 + : NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) < NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) ? last1 + : *first1 == *first2 + && sprout::search(sprout::next(first1), last1, sprout::next(first2), last2) == sprout::next(first1) + ? first1 + : sprout::search(sprout::next(first1), last1, first2, last2) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator1 search( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2, + BinaryPredicate pred + ) + { + return first1 == last1 || first2 == last2 ? first1 + : NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) < NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) ? last1 + : *first1 == *first2 + && sprout::search(sprout::next(first1), last1, sprout::next(first2), last2, pred) == sprout::next(first1) + ? first1 + : sprout::search(sprout::next(first1), last1, first2, last2, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_SEARCH_HPP diff --git a/sprout/algorithm/search_n.hpp b/sprout/algorithm/search_n.hpp new file mode 100644 index 00000000..25b2964f --- /dev/null +++ b/sprout/algorithm/search_n.hpp @@ -0,0 +1,47 @@ +#ifndef SPROUT_ALGORITHM_SEARCH_N_HPP +#define SPROUT_ALGORITHM_SEARCH_N_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.2.13 Search + template + SPROUT_CONSTEXPR ForwardIterator search_n( + ForwardIterator first, + ForwardIterator last, + Size count, + T const& value + ) + { + return first == last || count == 0 ? first + : sprout::next(first) == last && count > 1 ? last + : *first == value + && sprout::search_n(sprout::next(first), last, count - 1, value) == sprout::next(first) + ? first + : sprout::search_n(sprout::next(first), last, count, value) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator search_n( + ForwardIterator first, + ForwardIterator last, + Size count, + T const& value, + BinaryPredicate pred + ) + { + return first == last || count == 0 ? first + : sprout::next(first) == last && count > 1 ? last + : *first == value + && sprout::search_n(sprout::next(first), last, count - 1, value, pred) == sprout::next(first) + ? first + : sprout::search_n(sprout::next(first), last, count, value, pred) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_SEARCH_N_HPP diff --git a/sprout/algorithm/upper_bound.hpp b/sprout/algorithm/upper_bound.hpp new file mode 100644 index 00000000..e54498da --- /dev/null +++ b/sprout/algorithm/upper_bound.hpp @@ -0,0 +1,33 @@ +#ifndef SPROUT_ALGORITHM_UPPER_BOUND_HPP +#define SPROUT_ALGORITHM_UPPER_BOUND_HPP + +#include +#include +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 25.4.3.2 upper_bound + template + SPROUT_CONSTEXPR ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, T const& value) { + return first == last ? last + : sprout::next(first) == last ? !(value < *first) ? last : first + : !(value < *(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2)) + ? upper_bound(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, last, value) + : sprout::upper_bound(first, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, value) + ; + } + + template + SPROUT_CONSTEXPR ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, T const& value, Compare comp) { + return first == last ? last + : sprout::next(first) == last ? !comp(value, *first) ? last : first + : !comp(value, *(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2)) + ? sprout::upper_bound(first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, last, value, comp) + : sprout::upper_bound(first, first + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2, value, comp) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_ALGORITHM_UPPER_BOUND_HPP diff --git a/sprout/array.hpp b/sprout/array.hpp index 518b09e7..a1f37905 100644 --- a/sprout/array.hpp +++ b/sprout/array.hpp @@ -12,7 +12,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION # include #endif @@ -196,7 +196,7 @@ namespace sprout { // template SPROUT_CONSTEXPR inline bool operator==(sprout::array const& lhs, sprout::array const& rhs) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal(lhs.begin(), lhs.end(), rhs.begin()); + return NS_SSCRISK_CEL_OR_SPROUT::equal(lhs.begin(), lhs.end(), rhs.begin()); } template SPROUT_CONSTEXPR inline bool operator!=(sprout::array const& lhs, sprout::array const& rhs) { @@ -204,7 +204,7 @@ namespace sprout { } template SPROUT_CONSTEXPR inline bool operator<(sprout::array const& lhs, sprout::array const& rhs) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return NS_SSCRISK_CEL_OR_SPROUT::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } template SPROUT_CONSTEXPR inline bool operator>(sprout::array const& lhs, sprout::array const& rhs) { diff --git a/sprout/cctype.hpp b/sprout/cctype.hpp new file mode 100644 index 00000000..56fd9235 --- /dev/null +++ b/sprout/cctype.hpp @@ -0,0 +1,7 @@ +#ifndef SPROUT_CCTYPE_HPP +#define SPROUT_CCTYPE_HPP + +#include +#include + +#endif // #ifndef SPROUT_CCTYPE_HPP diff --git a/sprout/config.hpp b/sprout/config.hpp index 55a57a65..3a77601b 100644 --- a/sprout/config.hpp +++ b/sprout/config.hpp @@ -30,15 +30,15 @@ #endif // #ifndef SPROUT_CONFIG_DISABLE_USER_DEFINED_LITERALS #ifndef SPROUT_CONFIG_USE_SSCRISK_CEL -# define HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL -# define HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -# define HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL -# define NS_SSCRISK_CEL_OR_SPROUT_DETAIL sprout::detail +# define HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT +# define HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +# define HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT +# define NS_SSCRISK_CEL_OR_SPROUT sprout #else // #ifndef SPROUT_CONFIG_USE_SSCRISK_CEL -# define HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL -# define HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -# define HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL -# define NS_SSCRISK_CEL_OR_SPROUT_DETAIL sscrisk::cel +# define HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT +# define HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +# define HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT +# define NS_SSCRISK_CEL_OR_SPROUT sscrisk::cel #endif // #ifndef SPROUT_CONFIG_USE_SSCRISK_CEL #ifndef SPROUT_CONFIG_DISABLE_SUPPORT_TEMPORARY_CONTAINER_ITERATION diff --git a/sprout/container/internal_begin_offset.hpp b/sprout/container/internal_begin_offset.hpp index 783838bc..7e6bbe5c 100644 --- a/sprout/container/internal_begin_offset.hpp +++ b/sprout/container/internal_begin_offset.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { // @@ -13,7 +13,7 @@ namespace sprout { // template SPROUT_CONSTEXPR typename sprout::container_traits::difference_type internal_begin_offset(Container const& cont) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::begin(cont)); + return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::begin(cont)); } } // namespace sprout diff --git a/sprout/container/internal_begin_offset_backward.hpp b/sprout/container/internal_begin_offset_backward.hpp index 24804ac8..774f5d37 100644 --- a/sprout/container/internal_begin_offset_backward.hpp +++ b/sprout/container/internal_begin_offset_backward.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { // @@ -13,7 +13,7 @@ namespace sprout { // template SPROUT_CONSTEXPR typename sprout::container_traits::difference_type internal_begin_offset_backward(Container const& cont) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), sprout::internal_end(cont)); + return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), sprout::internal_end(cont)); } } // namespace sprout diff --git a/sprout/container/internal_end_offset.hpp b/sprout/container/internal_end_offset.hpp index 039c5b79..6363e3ff 100644 --- a/sprout/container/internal_end_offset.hpp +++ b/sprout/container/internal_end_offset.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { // @@ -13,7 +13,7 @@ namespace sprout { // template SPROUT_CONSTEXPR typename sprout::container_traits::difference_type internal_end_offset(Container const& cont) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::end(cont)); + return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::end(cont)); } } // namespace sprout diff --git a/sprout/container/internal_end_offset_backward.hpp b/sprout/container/internal_end_offset_backward.hpp index 2025aa7b..1b1ddcfb 100644 --- a/sprout/container/internal_end_offset_backward.hpp +++ b/sprout/container/internal_end_offset_backward.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { // @@ -13,7 +13,7 @@ namespace sprout { // template SPROUT_CONSTEXPR typename sprout::container_traits::difference_type internal_end_offset_backward(Container const& cont) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::end(cont), sprout::internal_end(cont)); + return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::end(cont), sprout::internal_end(cont)); } } // namespace sprout diff --git a/sprout/container/size.hpp b/sprout/container/size.hpp index 65ba69c1..e2547b3a 100644 --- a/sprout/container/size.hpp +++ b/sprout/container/size.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { // @@ -13,7 +13,7 @@ namespace sprout { // template SPROUT_CONSTEXPR inline typename sprout::container_traits::difference_type size(Container const& cont) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), sprout::end(cont)); + return NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(cont), sprout::end(cont)); } } // namespace sprout diff --git a/sprout/cstdlib.hpp b/sprout/cstdlib.hpp new file mode 100644 index 00000000..961c26b9 --- /dev/null +++ b/sprout/cstdlib.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_CSTDLIB_HPP +#define SPROUT_CSTDLIB_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_CSTDLIB_HPP diff --git a/sprout/cstdlib/abs.hpp b/sprout/cstdlib/abs.hpp new file mode 100644 index 00000000..ba9f4f25 --- /dev/null +++ b/sprout/cstdlib/abs.hpp @@ -0,0 +1,31 @@ +#ifndef SPROUT_CSTDLIB_ABS_HPP +#define SPROUT_CSTDLIB_ABS_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.20.6.1 absClabsC‹y‚Ñ llabs ŠÖ” + SPROUT_CONSTEXPR int abs(int j) { + return j < 0 ? -j : j; + } + + SPROUT_CONSTEXPR long labs(long j) { + return j < 0 ? -j : j; + } + + SPROUT_CONSTEXPR long long llabs(long long j) { + return j < 0 ? -j : j; + } + + SPROUT_CONSTEXPR long abs(long j) { + return labs(j); + } + + SPROUT_CONSTEXPR long long abs(long long j) { + return llabs(j); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTDLIB_ABS_HPP diff --git a/sprout/cstdlib/div.hpp b/sprout/cstdlib/div.hpp new file mode 100644 index 00000000..530d7db9 --- /dev/null +++ b/sprout/cstdlib/div.hpp @@ -0,0 +1,82 @@ +#ifndef SPROUT_CSTDLIB_DIV_HPP +#define SPROUT_CSTDLIB_DIV_HPP + +#include +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { +# define SPROUT_DIV_T_TRAITS_IMPL(DIV_T) \ + typedef DIV_T type; \ + static SPROUT_CONSTEXPR std::size_t offsetof_quot = offsetof(DIV_T, quot); \ + static SPROUT_CONSTEXPR std::size_t offsetof_rem = offsetof(DIV_T, rem); + + template + struct div_t_traits {}; + template<> + struct div_t_traits { + public: + SPROUT_DIV_T_TRAITS_IMPL(std::div_t); + }; + template<> + struct div_t_traits { + public: + SPROUT_DIV_T_TRAITS_IMPL(std::ldiv_t); + }; + template<> + struct div_t_traits { + public: + SPROUT_DIV_T_TRAITS_IMPL(std::lldiv_t); + }; +# undef SPROUT_DIV_T_TRAITS_IMPL + + extern void* enabler; + + template< + typename T, + typename std::enable_if< + sprout::detail::div_t_traits::offsetof_quot == 0 + >::type*& = sprout::detail::enabler + > + SPROUT_CONSTEXPR typename sprout::detail::div_t_traits::type div_impl(T const& numer, T const& denom) { + return {numer / denom, numer % denom}; + } + + template< + typename T, + typename std::enable_if< + sprout::detail::div_t_traits::offsetof_rem == 0 + >::type*& = sprout::detail::enabler + > + SPROUT_CONSTEXPR typename sprout::detail::div_t_traits::type div_impl(T const &numer, T const& denom) { + return {numer % denom, numer / denom}; + } + } // namespace detail + + // 7.20.6.2 divCldivC‹y‚Ñ lldiv ŠÖ” + SPROUT_CONSTEXPR std::div_t div(int numer, int denom) { + return sprout::detail::div_impl(numer, denom); + } + + SPROUT_CONSTEXPR std::ldiv_t ldiv(long numer, long denom) { + return sprout::detail::div_impl(numer, denom); + } + + SPROUT_CONSTEXPR std::lldiv_t lldiv(long long numer, long long denom) { + return sprout::detail::div_impl(numer, denom); + } + + SPROUT_CONSTEXPR std::ldiv_t div(long numer, long denom) { + return sprout::ldiv(numer, denom); + } + + SPROUT_CONSTEXPR std::lldiv_t div(long long numer, long long denom) { + return sprout::lldiv(numer, denom); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTDLIB_DIV_HPP diff --git a/sprout/cstring.hpp b/sprout/cstring.hpp new file mode 100644 index 00000000..a2c3829d --- /dev/null +++ b/sprout/cstring.hpp @@ -0,0 +1,18 @@ +#ifndef SPROUT_CSTRING_HPP +#define SPROUT_CSTRING_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_CSTRING_HPP diff --git a/sprout/cstring/memchr.hpp b/sprout/cstring/memchr.hpp new file mode 100644 index 00000000..089c59b7 --- /dev/null +++ b/sprout/cstring/memchr.hpp @@ -0,0 +1,31 @@ +#ifndef SPROUT_CSTRING_MEMCHR_HPP +#define SPROUT_CSTRING_MEMCHR_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + inline SPROUT_CONSTEXPR void const* memchr_impl(unsigned char const* s, char c, std::size_t n) { + return !n ? 0 + : *s == c ? s + : sprout::detail::memchr_impl(s + 1, c, n - 1) + ; + } + } // namespace detail + + // 7.21.5.1 memchr ŠÖ” + inline SPROUT_CONSTEXPR void const* memchr(void const* s, int c, size_t n) { + return sprout::detail::memchr_impl(static_cast(s), static_cast(c), n); + } + + inline SPROUT_CONSTEXPR void* memchr(void* s, int c, size_t n) { + return const_cast( + sprout::detail::memchr_impl(static_cast(s), static_cast(c), n) + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_MEMCHR_HPP diff --git a/sprout/cstring/memcmp.hpp b/sprout/cstring/memcmp.hpp new file mode 100644 index 00000000..c9f40a67 --- /dev/null +++ b/sprout/cstring/memcmp.hpp @@ -0,0 +1,29 @@ +#ifndef SPROUT_CSTRING_MEMCMP_HPP +#define SPROUT_CSTRING_MEMCMP_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + inline SPROUT_CONSTEXPR int memcmp_impl(unsigned char const* s1, unsigned char const* s2, std::size_t n) { + return !n ? 0 + : *s1 == *s2 ? sprout::detail::memcmp_impl(s1 + 1, s2 + 1, n - 1) + : *s1 - *s2 + ; + } + } // namespace detail + + // 7.21.4.1 memcmp ŠÖ” + inline SPROUT_CONSTEXPR int memcmp(void const * s1, void const * s2, std::size_t n) { + return sprout::detail::memcmp_impl( + static_cast(s1), + static_cast(s2), + n + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_MEMCMP_HPP diff --git a/sprout/cstring/strchr.hpp b/sprout/cstring/strchr.hpp new file mode 100644 index 00000000..27a9d151 --- /dev/null +++ b/sprout/cstring/strchr.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_CSTRING_STRCHR_HPP +#define SPROUT_CSTRING_STRCHR_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.5.2 strchr ŠÖ” + inline SPROUT_CONSTEXPR char const* strchr(char const* s, int c) { + return *s == static_cast(c) ? s + : !*s ? nullptr + : sprout::strchr(s + 1, c) + ; + } + + inline SPROUT_CONSTEXPR char* strchr(char* s, int c) { + return const_cast(sprout::strchr(const_cast(s), c)); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRCHR_HPP diff --git a/sprout/cstring/strcmp.hpp b/sprout/cstring/strcmp.hpp new file mode 100644 index 00000000..95b6de8d --- /dev/null +++ b/sprout/cstring/strcmp.hpp @@ -0,0 +1,20 @@ +#ifndef SPROUT_CSTRING_STRCMP_HPP +#define SPROUT_CSTRING_STRCMP_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.4.2 strcmp ŠÖ” + inline SPROUT_CONSTEXPR int strcmp(char const* s1, char const* s2) { + return !*s1 && !*s2 ? 0 + : !*s1 ? -1 + : !*s2 ? 1 + : *s1 == *s2 ? sprout::strcmp(s1 + 1, s2 + 1) + : static_cast(*s1) - static_cast(*s2) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRCMP_HPP diff --git a/sprout/cstring/strcoll.hpp b/sprout/cstring/strcoll.hpp new file mode 100644 index 00000000..f87632a7 --- /dev/null +++ b/sprout/cstring/strcoll.hpp @@ -0,0 +1,16 @@ +#ifndef SPROUT_CSTRING_STRCOLL_HPP +#define SPROUT_CSTRING_STRCOLL_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.4.3 strcoll ŠÖ” + inline SPROUT_CONSTEXPR int strcoll(char const* s1, char const* s2) { + return sprout::strcmp(s1, s2); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRCOLL_HPP diff --git a/sprout/cstring/strcspn.hpp b/sprout/cstring/strcspn.hpp new file mode 100644 index 00000000..fa32fa33 --- /dev/null +++ b/sprout/cstring/strcspn.hpp @@ -0,0 +1,25 @@ +#ifndef SPROUT_CSTRING_STRCSPN_HPP +#define SPROUT_CSTRING_STRCSPN_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + inline SPROUT_CONSTEXPR std::size_t strcspn_impl(char const* s1, char const* s2, std::size_t n) { + return !*s1 || sprout::strchr(s2, *s1) ? n + : sprout::detail::strcspn_impl(s1 + 1, s2, n + 1) + ; + } + } // amespace detail + + // 7.21.5.3 strcspn ŠÖ” + inline SPROUT_CONSTEXPR std::size_t strcspn(char const* s1, char const* s2) { + return sprout::detail::strcspn_impl(s1, s2, 0); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRCSPN_HPP diff --git a/sprout/cstring/strlen.hpp b/sprout/cstring/strlen.hpp new file mode 100644 index 00000000..58c67bfd --- /dev/null +++ b/sprout/cstring/strlen.hpp @@ -0,0 +1,24 @@ +#ifndef SPROUT_CSTRING_STRLEN_HPP +#define SPROUT_CSTRING_STRLEN_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + inline SPROUT_CONSTEXPR std::size_t strlen_impl(char const* s, std::size_t n) { + return !*s ? n : + sprout::detail::strlen_impl(s + 1, n + 1) + ; + } + } // namespace detail + + // 7.21.6.3 strlen ŠÖ” + inline SPROUT_CONSTEXPR std::size_t strlen(char const* s) { + return sprout::detail::strlen_impl(s, 0); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRLEN_HPP diff --git a/sprout/cstring/strncmp.hpp b/sprout/cstring/strncmp.hpp new file mode 100644 index 00000000..78fadd2d --- /dev/null +++ b/sprout/cstring/strncmp.hpp @@ -0,0 +1,21 @@ +#ifndef SPROUT_CSTRING_STRNCMP_HPP +#define SPROUT_CSTRING_STRNCMP_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.4.4 strncmp ŠÖ” + inline SPROUT_CONSTEXPR int strncmp(char const* s1, char const* s2, std::size_t n) { + return !n || (!*s1 && !*s2) ? 0 + : !*s1 ? -1 + : !*s2 ? 1 + : *s1 == *s2 ? sprout::strncmp(s1 + 1, s2 + 1, n - 1) + : static_cast(*s1) - static_cast(*s2) + ; + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRNCMP_HPP diff --git a/sprout/cstring/strpbrk.hpp b/sprout/cstring/strpbrk.hpp new file mode 100644 index 00000000..9bb98689 --- /dev/null +++ b/sprout/cstring/strpbrk.hpp @@ -0,0 +1,24 @@ +#ifndef SPROUT_CSTRING_STRPBRK_HPP +#define SPROUT_CSTRING_STRPBRK_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.5.4 strpbrk ŠÖ” + inline SPROUT_CONSTEXPR char const* strpbrk(char const* s1, char const* s2) { + return !*s1 ? nullptr + : sprout::strchr(s2, *s1) ? s1 + : sprout::strpbrk(s1 + 1, s2) + ; + } + + inline SPROUT_CONSTEXPR char* strpbrk(char* s1, char const* s2) { + return const_cast(sprout::strpbrk(const_cast(s1), s2)); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRPBRK_HPP diff --git a/sprout/cstring/strrchr.hpp b/sprout/cstring/strrchr.hpp new file mode 100644 index 00000000..55c17c26 --- /dev/null +++ b/sprout/cstring/strrchr.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_CSTRING_STRRCHR_HPP +#define SPROUT_CSTRING_STRRCHR_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.5.5 strrchr ŠÖ” + inline SPROUT_CONSTEXPR char const* strrchr(char const* s, int c) { + return *s == static_cast(c) && (!*s || !sprout::strrchr(s + 1, c))? s + : !*s ? nullptr + : sprout::strrchr(s + 1, c) + ; + } + + inline SPROUT_CONSTEXPR char* strrchr(char* s, int c) { + return const_cast(sprout::strrchr(const_cast(s), c)); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRRCHR_HPP diff --git a/sprout/cstring/strspn.hpp b/sprout/cstring/strspn.hpp new file mode 100644 index 00000000..f11a7484 --- /dev/null +++ b/sprout/cstring/strspn.hpp @@ -0,0 +1,25 @@ +#ifndef SPROUT_CSTRING_STRSPN_HPP +#define SPROUT_CSTRING_XXX_HPP + +#include +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + namespace detail { + inline SPROUT_CONSTEXPR std::size_t strspn_impl(char const* s1, char const* s2, std::size_t n) { + return !*s1 || !sprout::strchr(s2, *s1) ? n + : sprout::detail::strspn_impl(s1 + 1, s2, n + 1) + ; + } + } // namespace detail + + // 7.21.5.6 strspn ŠÖ” + inline SPROUT_CONSTEXPR std::size_t strspn(char const* s1, char const* s2) { + return sprout::detail::strspn_impl(s1, s2, 0); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_XXX_HPP diff --git a/sprout/cstring/strstr.hpp b/sprout/cstring/strstr.hpp new file mode 100644 index 00000000..3338f2f1 --- /dev/null +++ b/sprout/cstring/strstr.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_CSTRING_STRSTR_HPP +#define SPROUT_CSTRING_STRSTR_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 7.21.5.7 strstr ŠÖ” + inline SPROUT_CONSTEXPR char const* strstr(char const* s1, char const* s2) { + return !*s2 ? s1 + : !*s1 ? nullptr + : *s1 == *s2 && sprout::strstr(s1 + 1, s2 + 1) ? s1 + : sprout::strstr(s1 + 1, s2) + ; + } + + inline SPROUT_CONSTEXPR char* strstr(char* s1, char const* s2) { + return const_cast(sprout::strstr(const_cast(s1), s2)); + } +} // namespace sprout + +#endif // #ifndef SPROUT_CSTRING_STRSTR_HPP diff --git a/sprout/ctype/ascii.hpp b/sprout/ctype/ascii.hpp index 39bb99c2..be629ced 100644 --- a/sprout/ctype/ascii.hpp +++ b/sprout/ctype/ascii.hpp @@ -6,6 +6,8 @@ namespace sprout { namespace ascii { + // Copyright (C) 2011 RiSK (sscrisk) + namespace detail { SPROUT_STATIC_CONSTEXPR std::size_t alpha = 1 << 0; SPROUT_STATIC_CONSTEXPR std::size_t blank = 1 << 1; diff --git a/sprout/darkroom/lights/point_light.hpp b/sprout/darkroom/lights/point_light.hpp index c6f2684d..0205e5e1 100644 --- a/sprout/darkroom/lights/point_light.hpp +++ b/sprout/darkroom/lights/point_light.hpp @@ -13,7 +13,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace darkroom { @@ -82,7 +82,7 @@ namespace sprout { > sprout::darkroom::coords::length(diff) || sprout::darkroom::intersects::distance(light_ray_inter) < std::numeric_limits::epsilon() - ? NS_SSCRISK_CEL_OR_SPROUT_DETAIL::max( + ? NS_SSCRISK_CEL_OR_SPROUT::max( std::numeric_limits::epsilon(), sprout::darkroom::coords::dot( direction, diff --git a/sprout/detail/algorithm.hpp b/sprout/detail/algorithm.hpp deleted file mode 100644 index 214da234..00000000 --- a/sprout/detail/algorithm.hpp +++ /dev/null @@ -1,177 +0,0 @@ -#ifndef SPROUT_DETAIL_ALGORITHM_HPP -#define SPROUT_DETAIL_ALGORITHM_HPP - -#include -#include -#include - -namespace sprout { - namespace detail { - // - // min - // - template - SPROUT_CONSTEXPR T const& min(T const& a, T const& b) { - return b < a ? b : a; - } - template - SPROUT_CONSTEXPR T const& min(T const& a, T const& b, Compare comp) { - return comp(b, a) ? b : a; - } - - // - // max - // - template - SPROUT_CONSTEXPR T const& max(T const& a, T const& b) { - return a < b ? b : a; - } - template - SPROUT_CONSTEXPR T const& max(T const& a, T const& b, Compare comp) { - return comp(a, b) ? b : a; - } - - // - // count - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count( - InputIterator first, - InputIterator last, - T const& value - ) - { - return first == last - ? 0 - : (*first == value ? 1 : 0) + sprout::detail::count(sprout::next(first), last, value) - ; - } - - // - // count_if - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_if( - InputIterator first, - InputIterator last, - Predicate pred - ) - { - return first == last - ? 0 - : (pred(*first) ? 1 : 0) + sprout::detail::count_if(sprout::next(first), last, pred) - ; - } - - // - // equal - // - template - SPROUT_CONSTEXPR bool equal( - InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2 - ) - { - return first1 == last1 - ? true - : *first1 == *first2 && sprout::detail::equal(sprout::next(first1), last1, sprout::next(first2)) - ; - } - template - SPROUT_CONSTEXPR bool equal( - InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2, - Predicate pred - ) - { - return first1 == last1 - ? true - : pred(*first1, *first2) && sprout::detail::equal(sprout::next(first1), last1, sprout::next(first2), pred) - ; - } - - // - // lexicographical_compare - // - template - SPROUT_CONSTEXPR bool lexicographical_compare( - InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2, - InputIterator2 last2 - ) - { - return first2 == last2 - ? false - : first1 == last1 || *first1 < *first2 - ? true - : *first2 < *first1 - ? false - : sprout::detail::lexicographical_compare(sprout::next(first1), last1, sprout::next(first2), last2) - ; - } - template - SPROUT_CONSTEXPR bool lexicographical_compare( - InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2, - InputIterator2 last2, - Compare comp - ) - { - return first2 == last2 - ? false - : first1 == last1 || comp(*first1, *first2) - ? true - : comp(*first2, *first1) - ? false - : sprout::detail::lexicographical_compare(sprout::next(first1), last1, sprout::next(first2), last2, comp) - ; - } - - // - // find - // - template - SPROUT_CONSTEXPR InputIterator find(InputIterator first, InputIterator last, T const& value) { - return first == last || *first == value - ? first - : sprout::detail::find(sprout::next(first), last, value) - ; - } - - // - // is_sorted_until - // - template - SPROUT_CONSTEXPR InputIterator is_sorted_until(InputIterator first, InputIterator last) { - return first == last || sprout::next(first) == last ? last - : *sprout::next(first) < *first ? sprout::next(first) - : sprout::detail::is_sorted_until(sprout::next(first), last) - ; - } - template - SPROUT_CONSTEXPR InputIterator is_sorted_until(InputIterator first, InputIterator last, Compare comp) { - return first == last || sprout::next(first) == last ? last - : comp(*sprout::next(first), *first) != false ? sprout::next(first) - : sprout::detail::is_sorted_until(sprout::next(first), last) - ; - } - - // - // is_sorted - // - template - SPROUT_CONSTEXPR bool is_sorted(InputIterator first, InputIterator last) { - return sprout::detail::is_sorted_until(first, last) == last; - } - template - SPROUT_CONSTEXPR bool is_sorted(InputIterator first, InputIterator last, Compare comp) { - return sprout::detail::is_sorted_until(first, last, comp) == last; - } - } // namespace detail -} // namespace sprout - -#endif // #ifndef SPROUT_DETAIL_ALGORITHM_HPP diff --git a/sprout/detail/functional.hpp b/sprout/detail/functional.hpp deleted file mode 100644 index 1c366f96..00000000 --- a/sprout/detail/functional.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SPROUT_DETAIL_FUNCTIONAL_HPP -#define SPROUT_DETAIL_FUNCTIONAL_HPP - -#include -#include - -namespace sprout { - namespace detail { - // - // equal_to - // - template - class equal_to - : public std::binary_function - { - public: - SPROUT_CONSTEXPR bool operator()(T const& lhs, T const& rhs) const { - return lhs == rhs; - } - }; - - // - // less - // - template - class less - : public std::binary_function - { - public: - SPROUT_CONSTEXPR bool operator()(T const& lhs, T const& rhs) const { - return lhs < rhs; - } - }; - } // namespace detail -} // namespace sprout - -#endif // #ifndef SPROUT_DETAIL_FUNCTIONAL_HPP diff --git a/sprout/detail/iterator.hpp b/sprout/detail/iterator.hpp deleted file mode 100644 index 263f6ab2..00000000 --- a/sprout/detail/iterator.hpp +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef SPROUT_DETAIL_ITERATOR_HPP -#define SPROUT_DETAIL_ITERATOR_HPP - -#include -#include -#include - -namespace sprout { - namespace detail { - namespace detail_ { - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type distance( - Iterator first, - Iterator last - ) - { - return first == last - ? 0 - : 1 + sprout::detail::detail_::distance(sprout::next(first), last) - ; - } - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type distance_impl( - Iterator first, - Iterator last - ) - { - using sprout::detail::detail_::distance; - return distance(first, last); - } - } // namespace detail_ - // - // distance - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type distance( - Iterator first, - Iterator last - ) - { - return sprout::detail::detail_::distance_impl(first, last); - } - - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type bidirectional_distance_impl( - Iterator first1, - Iterator first2, - Iterator last, - typename std::iterator_traits::difference_type current = 1 - ) - { - return first1 == last - ? current - : first2 == last - ? -current - : sprout::detail::bidirectional_distance_impl(sprout::next(first1), sprout::prev(first2), last, current + 1) - ; - } - // - // bidirectional_distance - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type bidirectional_distance( - Iterator first, - Iterator last - ) - { - return first == last - ? 0 - : sprout::detail::bidirectional_distance_impl(sprout::next(first), sprout::prev(first), last) - ; - } - } // namespace detail -} // namespace sprout - -#endif // #ifndef SPROUT_DETAIL_ITERATOR_HPP diff --git a/sprout/detail/iterator_ext.hpp b/sprout/detail/iterator_ext.hpp new file mode 100644 index 00000000..a9a73af7 --- /dev/null +++ b/sprout/detail/iterator_ext.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_DETAIL_ITERATOR_EXT_HPP +#define SPROUT_DETAIL_ITERATOR_EXT_HPP + +#include +#include +#include + +namespace sprout { + namespace detail { + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type bidirectional_distance_impl( + Iterator first1, + Iterator first2, + Iterator last, + typename std::iterator_traits::difference_type current = 1 + ) + { + return first1 == last ? current + : first2 == last ? -current + : sprout::detail::bidirectional_distance_impl(sprout::next(first1), sprout::prev(first2), last, current + 1) + ; + } + + // + // bidirectional_distance + // + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type bidirectional_distance( + Iterator first, + Iterator last + ) + { + return first == last ? 0 + : sprout::detail::bidirectional_distance_impl(sprout::next(first), sprout::prev(first), last) + ; + } + } // namespace detail +} // namespace sprout + +#endif // #ifndef SPROUT_DETAIL_ITERATOR_EXT_HPP diff --git a/sprout/functional.hpp b/sprout/functional.hpp new file mode 100644 index 00000000..a32beb75 --- /dev/null +++ b/sprout/functional.hpp @@ -0,0 +1,10 @@ +#ifndef SPROUT_FUNCTIONAL_HPP +#define SPROUT_FUNCTIONAL_HPP + +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_FUNCTIONAL_HPP diff --git a/sprout/functional/arithmetic.hpp b/sprout/functional/arithmetic.hpp new file mode 100644 index 00000000..a6b40ff7 --- /dev/null +++ b/sprout/functional/arithmetic.hpp @@ -0,0 +1,12 @@ +#ifndef SPROUT_FUNCTIONAL_ARITHMETIC_HPP +#define SPROUT_FUNCTIONAL_ARITHMETIC_HPP + +#include +#include +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_FUNCTIONAL_ARITHMETIC_HPP diff --git a/sprout/functional/bind1st.hpp b/sprout/functional/bind1st.hpp new file mode 100644 index 00000000..e75f9689 --- /dev/null +++ b/sprout/functional/bind1st.hpp @@ -0,0 +1,34 @@ +#ifndef SPROUT_FUNCTIONAL_BIND1ST_HPP +#define SPROUT_FUNCTIONAL_BIND1ST_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // D.9.1 Class template binder1st + template + class binder1st + : public std::unary_function + { + protected: + Fn op; + typename Fn::first_argument_type value; + public: + SPROUT_CONSTEXPR binder1st(Fn const& x, typename Fn::first_argument_type const& y) + : op(x), value(y) + {} + SPROUT_CONSTEXPR typename Fn::result_type operator()(typename Fn::second_argument_type const& x) const { + return op(value, x); + } + }; + + // D.9.2 bind1st + template + SPROUT_CONSTEXPR sprout::binder1st bind1st(Fn const& fn, T const& x) { + return sprout::binder1st(fn, typename Fn::first_argument_type(x)); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_BIND1ST_HPP diff --git a/sprout/functional/bind2nd.hpp b/sprout/functional/bind2nd.hpp new file mode 100644 index 00000000..f5b31200 --- /dev/null +++ b/sprout/functional/bind2nd.hpp @@ -0,0 +1,34 @@ +#ifndef SPROUT_FUNCTIONAL_BIND2ND_HPP +#define SPROUT_FUNCTIONAL_BIND2ND_HPP + +#include +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // D.9.3 Class template binder2nd + template + class binder2nd + : public std::unary_function + { + protected: + Fn op; + typename Fn::second_argument_type value; + public: + SPROUT_CONSTEXPR binder2nd(Fn const& x, typename Fn::second_argument_type const& y) + : op(x), value(y) + {} + SPROUT_CONSTEXPR typename Fn::result_type operator()(typename Fn::first_argument_type const& x) const { + return op(x, value); + } + }; + + // D.9.4 bind2nd + template + SPROUT_CONSTEXPR sprout::binder2nd bind2nd(Fn const& op, T const& x) { + return sprout::binder2nd(op, typename Fn::second_argument_type(x)); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_BIND2ND_HPP diff --git a/sprout/functional/comparison.hpp b/sprout/functional/comparison.hpp new file mode 100644 index 00000000..be693285 --- /dev/null +++ b/sprout/functional/comparison.hpp @@ -0,0 +1,12 @@ +#ifndef SPROUT_FUNCTIONAL_COMPARISON_HPP +#define SPROUT_FUNCTIONAL_COMPARISON_HPP + +#include +#include +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_FUNCTIONAL_COMPARISON_HPP diff --git a/sprout/functional/dft/dft_element.hpp b/sprout/functional/dft/dft_element.hpp index 890f08f9..1f6d15fd 100644 --- a/sprout/functional/dft/dft_element.hpp +++ b/sprout/functional/dft/dft_element.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace detail { @@ -40,7 +40,7 @@ namespace sprout { first, last, i, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } } // namespace sprout diff --git a/sprout/functional/dft/fit/dft.hpp b/sprout/functional/dft/fit/dft.hpp index 7d96670d..8f73cd3a 100644 --- a/sprout/functional/dft/fit/dft.hpp +++ b/sprout/functional/dft/fit/dft.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::dft(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/functional/dft/fit/idft.hpp b/sprout/functional/dft/fit/idft.hpp index 7da15e25..6d543683 100644 --- a/sprout/functional/dft/fit/idft.hpp +++ b/sprout/functional/dft/fit/idft.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::idft(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/functional/dft/fixed/dft.hpp b/sprout/functional/dft/fixed/dft.hpp index 8ead93c7..3733a822 100644 --- a/sprout/functional/dft/fixed/dft.hpp +++ b/sprout/functional/dft/fixed/dft.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -47,7 +47,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } } // namespace detail diff --git a/sprout/functional/dft/fixed/idft.hpp b/sprout/functional/dft/fixed/idft.hpp index 364f5cd1..e058d750 100644 --- a/sprout/functional/dft/fixed/idft.hpp +++ b/sprout/functional/dft/fixed/idft.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -47,7 +47,7 @@ namespace sprout { typename sprout::index_range<0, sprout::container_traits::static_size>::type(), sprout::internal_begin_offset(result), sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } } // namespace detail diff --git a/sprout/functional/dft/idft_element.hpp b/sprout/functional/dft/idft_element.hpp index b4be4e01..7522176a 100644 --- a/sprout/functional/dft/idft_element.hpp +++ b/sprout/functional/dft/idft_element.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace detail { @@ -42,7 +42,7 @@ namespace sprout { first, last, i, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) ); } } // namespace sprout diff --git a/sprout/functional/divides.hpp b/sprout/functional/divides.hpp new file mode 100644 index 00000000..5e727b72 --- /dev/null +++ b/sprout/functional/divides.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_DEVIDES_HPP +#define SPROUT_FUNCTIONAL_DEVIDES_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.4 Arithmetic operations + template + struct divides { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef T result_type; + public: + SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const { + return x / y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_DEVIDES_HPP diff --git a/sprout/functional/equal_to.hpp b/sprout/functional/equal_to.hpp new file mode 100644 index 00000000..699faa42 --- /dev/null +++ b/sprout/functional/equal_to.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_EQUAL_TO_HPP +#define SPROUT_FUNCTIONAL_EQUAL_TO_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.5 Comparisons + template + struct equal_to { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + public: + SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const { + return x == y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_EQUAL_TO_HPP diff --git a/sprout/functional/greater.hpp b/sprout/functional/greater.hpp new file mode 100644 index 00000000..ad5bd6c7 --- /dev/null +++ b/sprout/functional/greater.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_GREATER_HPP +#define SPROUT_FUNCTIONAL_GREATER_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.5 Comparisons + template + struct greater { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + public: + SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const { + return x > y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_GREATER_HPP diff --git a/sprout/functional/greater_equal.hpp b/sprout/functional/greater_equal.hpp new file mode 100644 index 00000000..6ab2013c --- /dev/null +++ b/sprout/functional/greater_equal.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_GREATER_EQUAL_HPP +#define SPROUT_FUNCTIONAL_GREATER_EQUAL_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.5 Comparisons + template + struct greater_equal { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + public: + SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const { + return x >= y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_GREATER_EQUAL_HPP diff --git a/sprout/functional/less.hpp b/sprout/functional/less.hpp new file mode 100644 index 00000000..2cc33c8b --- /dev/null +++ b/sprout/functional/less.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_LESS_HPP +#define SPROUT_FUNCTIONAL_LESS_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.5 Comparisons + template + struct less { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + public: + SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const { + return x < y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_LESS_HPP diff --git a/sprout/functional/less_equal.hpp b/sprout/functional/less_equal.hpp new file mode 100644 index 00000000..c15c06a6 --- /dev/null +++ b/sprout/functional/less_equal.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_LESS_EQUAL_HPP +#define SPROUT_FUNCTIONAL_LESS_EQUAL_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.5 Comparisons + template + struct less_equal { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + public: + SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const { + return x <= y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_LESS_EQUAL_HPP diff --git a/sprout/functional/minus.hpp b/sprout/functional/minus.hpp new file mode 100644 index 00000000..a6a2d80d --- /dev/null +++ b/sprout/functional/minus.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_MINUS_HPP +#define SPROUT_FUNCTIONAL_MINUS_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.4 Arithmetic operations + template + struct minus { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef T result_type; + public: + SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const { + return x - y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_MINUS_HPP diff --git a/sprout/functional/modulus.hpp b/sprout/functional/modulus.hpp new file mode 100644 index 00000000..1f36e9f9 --- /dev/null +++ b/sprout/functional/modulus.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_MODULUS_HPP +#define SPROUT_FUNCTIONAL_X_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.4 Arithmetic operations + template + struct modulus { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef T result_type; + public: + SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const { + return x % y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_MODULUS_HPP diff --git a/sprout/functional/multiplies.hpp b/sprout/functional/multiplies.hpp new file mode 100644 index 00000000..ed58af1f --- /dev/null +++ b/sprout/functional/multiplies.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_MULTIPLIES_HPP +#define SPROUT_FUNCTIONAL_MULTIPLIES_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.4 Arithmetic operations + template + struct multiplies { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef T result_type; + public: + SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const { + return x * y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_MULTIPLIES_HPP diff --git a/sprout/functional/negate.hpp b/sprout/functional/negate.hpp new file mode 100644 index 00000000..3eb59d2d --- /dev/null +++ b/sprout/functional/negate.hpp @@ -0,0 +1,22 @@ +#ifndef SPROUT_FUNCTIONAL_NEGATE_HPP +#define SPROUT_FUNCTIONAL_NEGATE_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.4 Arithmetic operations + template + struct negate { + public: + typedef T argument_type; + typedef T result_type; + public: + SPROUT_CONSTEXPR T operator()(T const& x) const { + return -x; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_NEGATE_HPP diff --git a/sprout/functional/not_equal_to.hpp b/sprout/functional/not_equal_to.hpp new file mode 100644 index 00000000..9263296b --- /dev/null +++ b/sprout/functional/not_equal_to.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_NOT_EQUAL_TO_HPP +#define SPROUT_FUNCTIONAL_NOT_EQUAL_TO_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.5 Comparisons + template + struct not_equal_to { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef bool result_type; + public: + SPROUT_CONSTEXPR bool operator()(T const& x, T const& y) const { + return x != y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_NOT_EQUAL_TO_HPP diff --git a/sprout/functional/plus.hpp b/sprout/functional/plus.hpp new file mode 100644 index 00000000..e511d892 --- /dev/null +++ b/sprout/functional/plus.hpp @@ -0,0 +1,23 @@ +#ifndef SPROUT_FUNCTIONAL_PLUS_HPP +#define SPROUT_FUNCTIONAL_PLUS_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 20.8.4 Arithmetic operations + template + struct plus { + public: + typedef T first_argument_type; + typedef T second_argument_type; + typedef T result_type; + public: + SPROUT_CONSTEXPR T operator()(T const& x, T const& y) const { + return x + y; + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_PLUS_HPP diff --git a/sprout/iterator/distance.hpp b/sprout/iterator/distance.hpp new file mode 100644 index 00000000..31e94511 --- /dev/null +++ b/sprout/iterator/distance.hpp @@ -0,0 +1,36 @@ +#ifndef SPROUT_ITERATOR_DISTANCE_HPP +#define SPROUT_ITERATOR_DISTANCE_HPP + +#include +#include +#include + +namespace sprout { + namespace detail { + // Copyright (C) 2011 RiSK (sscrisk) + + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type + distance(Iterator first, Iterator last) { + return first == last ? 0 + : 1 + sprout::detail::distance(sprout::next(first), last) + ; + } + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type + distance_impl(Iterator first, Iterator last) { + using sprout::detail::distance; + return distance(first, last); + } + } // namespace detail + // + // distance + // + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type + distance(Iterator first, Iterator last) { + return sprout::detail::distance_impl(first, last); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ITERATOR_DISTANCE_HPP diff --git a/sprout/iterator/index_iterator.hpp b/sprout/iterator/index_iterator.hpp index d48b6abc..0b6daf56 100644 --- a/sprout/iterator/index_iterator.hpp +++ b/sprout/iterator/index_iterator.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include namespace sprout { @@ -211,22 +212,13 @@ namespace sprout { { return it - n; } -} // namespace sprout - - - -#include -namespace sprout { // // distance // template - SPROUT_CONSTEXPR typename std::iterator_traits >::difference_type distance( - sprout::index_iterator first, - sprout::index_iterator last - ) - { + SPROUT_CONSTEXPR typename std::iterator_traits >::difference_type + distance(sprout::index_iterator first, sprout::index_iterator last) { return last - first; } } // namespace sprout diff --git a/sprout/iterator/operation.hpp b/sprout/iterator/operation.hpp index 27cb5709..e4939889 100644 --- a/sprout/iterator/operation.hpp +++ b/sprout/iterator/operation.hpp @@ -4,5 +4,6 @@ #include #include #include +#include #endif // #ifndef SPROUT_ITERATOR_OPERATION_HPP diff --git a/sprout/iterator/value_iterator.hpp b/sprout/iterator/value_iterator.hpp index 9619f330..f93ec01e 100644 --- a/sprout/iterator/value_iterator.hpp +++ b/sprout/iterator/value_iterator.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace sprout { @@ -200,22 +201,13 @@ namespace sprout { { return it - n; } -} // namespace sprout - - - -#include -namespace sprout { // // distance // template - SPROUT_CONSTEXPR typename std::iterator_traits >::difference_type distance( - sprout::value_iterator first, - sprout::value_iterator last - ) - { + SPROUT_CONSTEXPR typename std::iterator_traits >::difference_type + distance(sprout::value_iterator first, sprout::value_iterator last) { return last - first; } } // namespace sprout diff --git a/sprout/numeric.hpp b/sprout/numeric.hpp index 4d55f62b..5d0d7f3a 100644 --- a/sprout/numeric.hpp +++ b/sprout/numeric.hpp @@ -2,7 +2,7 @@ #define SPROUT_NUMERIC_HPP #include -#include -#include +#include +#include #endif // #ifndef SPROUT_NUMERIC_HPP diff --git a/sprout/numeric/accumulate.hpp b/sprout/numeric/accumulate.hpp new file mode 100644 index 00000000..3a0f5bb7 --- /dev/null +++ b/sprout/numeric/accumulate.hpp @@ -0,0 +1,25 @@ +#ifndef SPROUT_NUMERIC_ACCUMLATE_HPP +#define SPROUT_NUMERIC_ACCUMLATE_HPP + +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 26.7.2 Accumulate + template + SPROUT_CONSTEXPR T accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op) { + return first == last ? init + : sprout::accumulate(first + 1, last, binary_op(init, *first), binary_op) + ; + } + + template + SPROUT_CONSTEXPR T accumulate(InputIterator first, InputIterator last, T init) { + return sprout::accumulate(first, last, init, NS_SSCRISK_CEL_OR_SPROUT::plus::value_type>()); + } +} // namespace sprout + +#endif // #ifndef SPROUT_NUMERIC_ACCUMLATE_HPP diff --git a/sprout/numeric/fit/adjacent_difference.hpp b/sprout/numeric/fit/adjacent_difference.hpp index d154080d..99a8fb30 100644 --- a/sprout/numeric/fit/adjacent_difference.hpp +++ b/sprout/numeric/fit/adjacent_difference.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::adjacent_difference(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail @@ -54,7 +54,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::adjacent_difference(first, last, result, binary_op)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/numeric/fit/partial_sum.hpp b/sprout/numeric/fit/partial_sum.hpp index e72a8e20..691dde53 100644 --- a/sprout/numeric/fit/partial_sum.hpp +++ b/sprout/numeric/fit/partial_sum.hpp @@ -7,8 +7,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { @@ -24,7 +24,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::partial_sum(first, last, result)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail @@ -54,7 +54,7 @@ namespace sprout { return sprout::sub_copy( sprout::get_internal(sprout::fixed::partial_sum(first, last, result, binary_op)), offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result)) ); } } // namespace detail diff --git a/sprout/numeric/inner_product.hpp b/sprout/numeric/inner_product.hpp new file mode 100644 index 00000000..6368e0bb --- /dev/null +++ b/sprout/numeric/inner_product.hpp @@ -0,0 +1,54 @@ +#ifndef SPROUT_NUMERIC_INNNER_PRODUCT_HPP +#define SPROUT_NUMERIC_INNNER_PRODUCT_HPP + +#include +#include +#include +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // 26.7.3 Inner product + template + SPROUT_CONSTEXPR T inner_product( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + T init, + BinaryOperation1 binary_op1, + BinaryOperation2 binary_op2 + ) + { + return first1 == last1 ? init + : sprout::inner_product( + sprout::next(first1), + last1, + sprout::next(first2), + binary_op1(init, binary_op2(*first1, *first2)), + binary_op1, + binary_op2 + ) + ; + } + + template + SPROUT_CONSTEXPR T inner_product( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + T init + ) + { + return sprout::inner_product( + first1, + last1, + first2, + init, + sprout::plus::value_type>(), + NS_SSCRISK_CEL_OR_SPROUT::multiplies::value_type>() + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_NUMERIC_INNNER_PRODUCT_HPP diff --git a/sprout/numeric/modifying.hpp b/sprout/numeric/modifying.hpp new file mode 100644 index 00000000..c7835efa --- /dev/null +++ b/sprout/numeric/modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_NUMERIC_MODIFYIING_HPP +#define SPROUT_NUMERIC_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_NUMERIC_MODIFYIING_HPP diff --git a/sprout/numeric/non_modifying.hpp b/sprout/numeric/non_modifying.hpp new file mode 100644 index 00000000..d748b72a --- /dev/null +++ b/sprout/numeric/non_modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_NUMERIC_NON_MODIFYIING_HPP +#define SPROUT_NUMERIC_NON_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_NUMERIC_NON_MODIFYIING_HPP diff --git a/sprout/operation/fixed/append.hpp b/sprout/operation/fixed/append.hpp index 916cd069..dc441dc2 100644 --- a/sprout/operation/fixed/append.hpp +++ b/sprout/operation/fixed/append.hpp @@ -6,7 +6,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -63,7 +63,7 @@ namespace sprout { return sprout::fixed::detail::append_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), pos), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), pos), sprout::size(input), input ); @@ -81,7 +81,7 @@ namespace sprout { return sprout::fixed::detail::append_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), sprout::size(input), input ); diff --git a/sprout/operation/fixed/erase.hpp b/sprout/operation/fixed/erase.hpp index bab4f2e7..cb6d405f 100644 --- a/sprout/operation/fixed/erase.hpp +++ b/sprout/operation/fixed/erase.hpp @@ -6,7 +6,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -59,7 +59,7 @@ namespace sprout { return sprout::fixed::detail::erase_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), pos) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), pos) ); } // @@ -74,7 +74,7 @@ namespace sprout { return sprout::fixed::detail::erase_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)) ); } } // namespace fixed diff --git a/sprout/operation/fixed/erase_n.hpp b/sprout/operation/fixed/erase_n.hpp index 4767de10..b340b400 100644 --- a/sprout/operation/fixed/erase_n.hpp +++ b/sprout/operation/fixed/erase_n.hpp @@ -7,7 +7,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -60,7 +60,7 @@ namespace sprout { return sprout::fixed::detail::erase_n_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), pos) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), pos) ); } // @@ -75,7 +75,7 @@ namespace sprout { return sprout::fixed::detail::erase_n_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)) ); } } // namespace fixed diff --git a/sprout/operation/fixed/insert.hpp b/sprout/operation/fixed/insert.hpp index 7e49cb41..4205b519 100644 --- a/sprout/operation/fixed/insert.hpp +++ b/sprout/operation/fixed/insert.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -66,7 +66,7 @@ namespace sprout { return sprout::fixed::detail::insert_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), pos), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), pos), v, values... ); @@ -85,7 +85,7 @@ namespace sprout { return sprout::fixed::detail::insert_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), v, values... ); diff --git a/sprout/operation/fixed/insert_n.hpp b/sprout/operation/fixed/insert_n.hpp index 7681f84d..2af436e9 100644 --- a/sprout/operation/fixed/insert_n.hpp +++ b/sprout/operation/fixed/insert_n.hpp @@ -10,7 +10,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -68,7 +68,7 @@ namespace sprout { return sprout::fixed::detail::insert_n_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), pos), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), pos), v, values... ); @@ -87,7 +87,7 @@ namespace sprout { return sprout::fixed::detail::insert_n_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), v, values... ); diff --git a/sprout/operation/fixed/set.hpp b/sprout/operation/fixed/set.hpp index b0cebf9d..ffd247a4 100644 --- a/sprout/operation/fixed/set.hpp +++ b/sprout/operation/fixed/set.hpp @@ -6,7 +6,7 @@ #include #include #include -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fixed { @@ -53,7 +53,7 @@ namespace sprout { return sprout::fixed::detail::set_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), pos), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), pos), v ); } @@ -70,7 +70,7 @@ namespace sprout { return sprout::fixed::detail::set_impl::type>( cont, typename sprout::index_range<0, sprout::container_traits::type>::static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), v ); } diff --git a/sprout/random/detail/uniform_int_float.hpp b/sprout/random/detail/uniform_int_float.hpp index 6a49ba1e..5b0b9a9d 100644 --- a/sprout/random/detail/uniform_int_float.hpp +++ b/sprout/random/detail/uniform_int_float.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace random { @@ -39,7 +39,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const { return ( result_type(2) << ( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min( + NS_SSCRISK_CEL_OR_SPROUT::min( std::numeric_limits::digits, sprout::random::detail::generator_bits::value() ) - 1 diff --git a/sprout/random/xor_combine.hpp b/sprout/random/xor_combine.hpp index afa1e973..961f8147 100644 --- a/sprout/random/xor_combine.hpp +++ b/sprout/random/xor_combine.hpp @@ -5,7 +5,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace random { @@ -49,10 +49,10 @@ namespace sprout { , rng2_(rng2) {} SPROUT_CONSTEXPR result_type min() const { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(rng1_.min(), rng2_.min()); + return NS_SSCRISK_CEL_OR_SPROUT::min(rng1_.min(), rng2_.min()); } SPROUT_CONSTEXPR result_type max() const { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::max(rng1_.max(), rng2_.max()); + return NS_SSCRISK_CEL_OR_SPROUT::max(rng1_.max(), rng2_.max()); } SPROUT_CONSTEXPR sprout::random::random_result operator()() const { return generate(rng1_(), rng2_()); diff --git a/sprout/range/algorithm.hpp b/sprout/range/algorithm.hpp index 27b7198c..2c34abd7 100644 --- a/sprout/range/algorithm.hpp +++ b/sprout/range/algorithm.hpp @@ -2,7 +2,7 @@ #define SPROUT_RANGE_ALGORITHM_HPP #include -#include -#include +#include +#include #endif // #ifndef SPROUT_RANGE_ALGORITHM_HPP diff --git a/sprout/range/algorithm/modifying.hpp b/sprout/range/algorithm/modifying.hpp new file mode 100644 index 00000000..1ca4fd83 --- /dev/null +++ b/sprout/range/algorithm/modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_ALGORITHM_MODIFYIING_HPP +#define SPROUT_RANGE_ALGORITHM_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_MODIFYIING_HPP diff --git a/sprout/range/algorithm/non_modifying.hpp b/sprout/range/algorithm/non_modifying.hpp new file mode 100644 index 00000000..78686a71 --- /dev/null +++ b/sprout/range/algorithm/non_modifying.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_RANGE_ALGORITHM_NON_MODIFYIING_HPP +#define SPROUT_RANGE_ALGORITHM_NON_MODIFYIING_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 + +#endif // #ifndef SPROUT_RANGE_ALGORITHM_NON_MODIFYIING_HPP diff --git a/sprout/range/numeric.hpp b/sprout/range/numeric.hpp index 8f0f533e..9d2ce370 100644 --- a/sprout/range/numeric.hpp +++ b/sprout/range/numeric.hpp @@ -2,7 +2,7 @@ #define SPROUT_RANGE_NUMERIC_HPP #include -#include -#include +#include +#include #endif // #ifndef SPROUT_RANGE_NUMERIC_HPP diff --git a/sprout/range/numeric/modifying.hpp b/sprout/range/numeric/modifying.hpp new file mode 100644 index 00000000..9f3767cd --- /dev/null +++ b/sprout/range/numeric/modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_MODIFYIING_HPP +#define SPROUT_RANGE_NUMERIC_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_MODIFYIING_HPP diff --git a/sprout/range/numeric/non_modifying.hpp b/sprout/range/numeric/non_modifying.hpp new file mode 100644 index 00000000..0bd1f10e --- /dev/null +++ b/sprout/range/numeric/non_modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP +#define SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP + +#include +//#include +//#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP diff --git a/sprout/string.hpp b/sprout/string.hpp index caeafb67..449ae56c 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -18,7 +18,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION # include # include @@ -209,7 +209,7 @@ namespace sprout { } static SPROUT_CONSTEXPR int compare_impl_1(value_type const* dest, size_type pos1, size_type n1, value_type const* s, size_type n2) { return compare_impl_2( - traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, n2)), + traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT::min(n1, n2)), n1, n2 ); @@ -230,14 +230,14 @@ namespace sprout { int >::type compare_impl_1(value_type const* dest, size_type pos1, size_type n1, ConstIterator s, size_type n2) { return compare_impl_2( - traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, n2)), + traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT::min(n1, n2)), n1, n2 ); } static SPROUT_CONSTEXPR int compare_impl_1(const_iterator dest, size_type pos1, size_type n1, value_type const* s, size_type n2) { return compare_impl_2( - traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, n2)), + traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT::min(n1, n2)), n1, n2 ); @@ -248,7 +248,7 @@ namespace sprout { int >::type compare_impl_1(const_iterator dest, size_type pos1, size_type n1, ConstIterator s, size_type n2) { return compare_impl_2( - traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, n2)), + traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT::min(n1, n2)), n1, n2 ); @@ -495,13 +495,13 @@ namespace sprout { template SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string const& str, size_type pos2, size_type n2) const { return !(str.size() < pos2) - ? compare(pos1, n1, str.begin() + pos2, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n2, str.size() - pos2)) + ? compare(pos1, n1, str.begin() + pos2, NS_SSCRISK_CEL_OR_SPROUT::min(n2, str.size() - pos2)) : throw std::out_of_range("basic_string<>: index out of range") ; } SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s, size_type n2) const { return !(size() < pos1) - ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, size() - pos1), s, n2) + ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT::min(n1, size() - pos1), s, n2) : throw std::out_of_range("basic_string<>: index out of range") ; } @@ -577,7 +577,7 @@ namespace sprout { int >::type compare(size_type pos1, size_type n1, ConstIterator s, size_type n2) const { return !(size() < pos1) - ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, size() - pos1), s, n2) + ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT::min(n1, size() - pos1), s, n2) : throw std::out_of_range("basic_string<>: index out of range") ; } diff --git a/sprout/sub_array.hpp b/sprout/sub_array.hpp index 000db3d0..83f5f9eb 100644 --- a/sprout/sub_array.hpp +++ b/sprout/sub_array.hpp @@ -11,8 +11,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace detail { @@ -136,8 +136,8 @@ namespace sprout { typename std::enable_if::value>::type* = 0 ) : array_{to_holder(arr)[Indexes]...} - , first_(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::cbegin(arr), first)) - , last_(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::cbegin(arr), last)) + , first_(NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::cbegin(arr), first)) + , last_(NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::cbegin(arr), last)) {} template SPROUT_CONSTEXPR sub_array_impl( @@ -149,8 +149,8 @@ namespace sprout { typename std::enable_if::value>::type* = 0 ) : array_(to_holder(arr)) - , first_(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::cbegin(arr), first)) - , last_(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::cbegin(arr), last)) + , first_(NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::cbegin(arr), first)) + , last_(NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::cbegin(arr), last)) {} template SPROUT_CONSTEXPR sub_array_impl( @@ -244,8 +244,8 @@ namespace sprout { array_tag(), impl_type::template to_param(other.array_), typename sprout::index_range<0, static_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(other.get_array()), first), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(other.get_array()), last) + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(other.get_array()), first), + NS_SSCRISK_CEL_OR_SPROUT::distance(sprout::begin(other.get_array()), last) ) {} SPROUT_CONSTEXPR sub_array(sub_array const& other, difference_type first, difference_type last) @@ -388,7 +388,7 @@ namespace sprout { // template SPROUT_CONSTEXPR inline bool operator==(sprout::sub_array const& lhs, sprout::sub_array const& rhs) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal(sprout::begin(lhs), sprout::end(lhs), sprout::begin(rhs)); + return NS_SSCRISK_CEL_OR_SPROUT::equal(sprout::begin(lhs), sprout::end(lhs), sprout::begin(rhs)); } template SPROUT_CONSTEXPR inline bool operator!=(sprout::sub_array const& lhs, sprout::sub_array const& rhs) { @@ -396,7 +396,7 @@ namespace sprout { } template SPROUT_CONSTEXPR inline bool operator<(sprout::sub_array const& lhs, sprout::sub_array const& rhs) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::lexicographical_compare(sprout::begin(lhs), sprout::end(lhs), sprout::begin(rhs), sprout::end(rhs)); + return NS_SSCRISK_CEL_OR_SPROUT::lexicographical_compare(sprout::begin(lhs), sprout::end(lhs), sprout::begin(rhs), sprout::end(rhs)); } template SPROUT_CONSTEXPR inline bool operator>(sprout::sub_array const& lhs, sprout::sub_array const& rhs) { diff --git a/sprout/utility.hpp b/sprout/utility.hpp index 552b8f9e..9bacae00 100644 --- a/sprout/utility.hpp +++ b/sprout/utility.hpp @@ -3,5 +3,6 @@ #include #include +#include #endif // #ifndef SPROUT_UTILITY_HPP diff --git a/sprout/utility/pair.hpp b/sprout/utility/pair.hpp new file mode 100644 index 00000000..aea4f4fb --- /dev/null +++ b/sprout/utility/pair.hpp @@ -0,0 +1,38 @@ +#ifndef SPROUT_UTILITY_PAIR_HPP +#define SPROUT_UTILITY_PAIR_HPP + +#include + +namespace sprout { + // Copyright (C) 2011 RiSK (sscrisk) + + // + // pair + // + template + struct pair { + public: + typedef T1 first_type; + typedef T2 second_type; + public: + T1 first; + T2 second; + public: + SPROUT_CONSTEXPR pair(pair const&) = default; + SPROUT_CONSTEXPR pair() + : first() + , second() + {} + SPROUT_CONSTEXPR pair(T1 const& x, T2 const& y) + : first(x) + , second(y) + {} + template + SPROUT_CONSTEXPR pair(sprout::pair const& p) + : first(p.first) + , second(p.second) + {} + }; +} // namespace sprout + +#endif // #ifndef SPROUT_UTILITY_PAIR_HPP diff --git a/sprout/uuid/string_generator.hpp b/sprout/uuid/string_generator.hpp index df9d6b36..f60ac35d 100644 --- a/sprout/uuid/string_generator.hpp +++ b/sprout/uuid/string_generator.hpp @@ -9,8 +9,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace uuids { @@ -52,9 +52,9 @@ namespace sprout { template SPROUT_CONSTEXPR std::uint8_t get_value(Elem c) const { return value_at( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance( + NS_SSCRISK_CEL_OR_SPROUT::distance( sprout::uuids::detail::digits::table.begin(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::find( + NS_SSCRISK_CEL_OR_SPROUT::find( sprout::uuids::detail::digits::table.begin(), sprout::uuids::detail::digits::table.end(), c diff --git a/sprout/uuid/uuid.hpp b/sprout/uuid/uuid.hpp index 35f68873..3d0e3855 100644 --- a/sprout/uuid/uuid.hpp +++ b/sprout/uuid/uuid.hpp @@ -8,7 +8,7 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION # include #endif @@ -230,13 +230,13 @@ namespace sprout { // operator>= // SPROUT_CONSTEXPR inline bool operator==(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal(lhs.begin(), lhs.end(), rhs.begin()); + return NS_SSCRISK_CEL_OR_SPROUT::equal(lhs.begin(), lhs.end(), rhs.begin()); } SPROUT_CONSTEXPR inline bool operator!=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) { return !(lhs == rhs); } SPROUT_CONSTEXPR inline bool operator<(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return NS_SSCRISK_CEL_OR_SPROUT::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } SPROUT_CONSTEXPR inline bool operator>(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) { return rhs < lhs; diff --git a/sprout/weed/context/parse_context/terminal/string.hpp b/sprout/weed/context/parse_context/terminal/string.hpp index 42dd42bb..62e7927f 100644 --- a/sprout/weed/context/parse_context/terminal/string.hpp +++ b/sprout/weed/context/parse_context/terminal/string.hpp @@ -14,8 +14,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace weed { @@ -48,8 +48,8 @@ namespace sprout { context_type const& ctx ) const { - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(ctx.begin(), ctx.end()) >= sprout::size(arg) - &&NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal(sprout::begin(arg), sprout::end(arg), ctx.begin()) + return NS_SSCRISK_CEL_OR_SPROUT::distance(ctx.begin(), ctx.end()) >= sprout::size(arg) + &&NS_SSCRISK_CEL_OR_SPROUT::equal(sprout::begin(arg), sprout::end(arg), ctx.begin()) ? result_type( true, sprout::next(ctx.begin(), diff --git a/sprout/weed/detail/bdigits.hpp b/sprout/weed/detail/bdigits.hpp index 71c1b0d7..961e3dbe 100644 --- a/sprout/weed/detail/bdigits.hpp +++ b/sprout/weed/detail/bdigits.hpp @@ -6,8 +6,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace weed { @@ -71,9 +71,9 @@ namespace sprout { template SPROUT_CONSTEXPR sprout::tuples::tuple from_bdigit(Elem c) { return sprout::weed::detail::bvalue_at( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance( + NS_SSCRISK_CEL_OR_SPROUT::distance( sprout::weed::detail::bdigits::table.begin(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::find( + NS_SSCRISK_CEL_OR_SPROUT::find( sprout::weed::detail::bdigits::table.begin(), sprout::weed::detail::bdigits::table.end(), c diff --git a/sprout/weed/detail/digits.hpp b/sprout/weed/detail/digits.hpp index adaea7c5..6c7bada1 100644 --- a/sprout/weed/detail/digits.hpp +++ b/sprout/weed/detail/digits.hpp @@ -6,8 +6,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace weed { @@ -71,9 +71,9 @@ namespace sprout { template SPROUT_CONSTEXPR sprout::tuples::tuple from_digit(Elem c) { return sprout::weed::detail::value_at( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance( + NS_SSCRISK_CEL_OR_SPROUT::distance( sprout::weed::detail::digits::table.begin(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::find( + NS_SSCRISK_CEL_OR_SPROUT::find( sprout::weed::detail::digits::table.begin(), sprout::weed::detail::digits::table.end(), c diff --git a/sprout/weed/detail/odigits.hpp b/sprout/weed/detail/odigits.hpp index ea692df0..96246843 100644 --- a/sprout/weed/detail/odigits.hpp +++ b/sprout/weed/detail/odigits.hpp @@ -6,8 +6,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace weed { @@ -71,9 +71,9 @@ namespace sprout { template SPROUT_CONSTEXPR sprout::tuples::tuple from_odigit(Elem c) { return sprout::weed::detail::ovalue_at( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance( + NS_SSCRISK_CEL_OR_SPROUT::distance( sprout::weed::detail::odigits::table.begin(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::find( + NS_SSCRISK_CEL_OR_SPROUT::find( sprout::weed::detail::odigits::table.begin(), sprout::weed::detail::odigits::table.end(), c diff --git a/sprout/weed/detail/xdigits.hpp b/sprout/weed/detail/xdigits.hpp index 948c7f1e..eea2f619 100644 --- a/sprout/weed/detail/xdigits.hpp +++ b/sprout/weed/detail/xdigits.hpp @@ -6,8 +6,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace weed { @@ -71,9 +71,9 @@ namespace sprout { template SPROUT_CONSTEXPR sprout::tuples::tuple from_xdigit(Elem c) { return sprout::weed::detail::xvalue_at( - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance( + NS_SSCRISK_CEL_OR_SPROUT::distance( sprout::weed::detail::xdigits::table.begin(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::find( + NS_SSCRISK_CEL_OR_SPROUT::find( sprout::weed::detail::xdigits::table.begin(), sprout::weed::detail::xdigits::table.end(), c diff --git a/sprout/weed/parser/string/string.hpp b/sprout/weed/parser/string/string.hpp index 4157b7ca..aded7629 100644 --- a/sprout/weed/parser/string/string.hpp +++ b/sprout/weed/parser/string/string.hpp @@ -14,8 +14,8 @@ #include #include #include -#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL -#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace weed { @@ -53,8 +53,8 @@ namespace sprout { { typedef typename result::type result_type; typedef typename attribute::type attribute_type; - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) >= sprout::size(t_) - &&NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal(sprout::begin(t_), sprout::end(t_), first) + return NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) >= sprout::size(t_) + &&NS_SSCRISK_CEL_OR_SPROUT::equal(sprout::begin(t_), sprout::end(t_), first) ? result_type(true, sprout::next(first, sprout::size(t_)), attribute_type()) : result_type(false, first, typename attribute::type()) ; @@ -128,8 +128,8 @@ namespace sprout { { typedef typename result::type result_type; typedef typename attribute::type attribute_type; - return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) >= sprout::size(t_) - &&NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal(sprout::begin(t_), sprout::end(t_), first) + return NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) >= sprout::size(t_) + &&NS_SSCRISK_CEL_OR_SPROUT::equal(sprout::begin(t_), sprout::end(t_), first) ? result_type(true, sprout::next(first, sprout::size(t_)), attribute_type()) : result_type(false, first, typename attribute::type()) ;