diff --git a/sprout/algorithm/adjacent_find.hpp b/sprout/algorithm/adjacent_find.hpp index 7f0c1821..9a41503c 100644 --- a/sprout/algorithm/adjacent_find.hpp +++ b/sprout/algorithm/adjacent_find.hpp @@ -109,7 +109,7 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator adjacent_find( ForwardIterator first, ForwardIterator last, BinaryPredicate pred, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/all_of.hpp b/sprout/algorithm/all_of.hpp index 99189a9b..b3922134 100644 --- a/sprout/algorithm/all_of.hpp +++ b/sprout/algorithm/all_of.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool all_of( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/all_of_equal.hpp b/sprout/algorithm/all_of_equal.hpp index 54b2e520..6bfa6e02 100644 --- a/sprout/algorithm/all_of_equal.hpp +++ b/sprout/algorithm/all_of_equal.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool all_of_equal( InputIterator first, InputIterator last, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/any_of.hpp b/sprout/algorithm/any_of.hpp index 1aae2bf4..98f2549d 100644 --- a/sprout/algorithm/any_of.hpp +++ b/sprout/algorithm/any_of.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool any_of( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/any_of_equal.hpp b/sprout/algorithm/any_of_equal.hpp index 243f82b5..f3a9c81f 100644 --- a/sprout/algorithm/any_of_equal.hpp +++ b/sprout/algorithm/any_of_equal.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool any_of_equal( InputIterator first, InputIterator last, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/count.hpp b/sprout/algorithm/count.hpp index 5b0ce271..4d57c15d 100644 --- a/sprout/algorithm/count.hpp +++ b/sprout/algorithm/count.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count( InputIterator first, InputIterator last, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/algorithm/count_if.hpp b/sprout/algorithm/count_if.hpp index c34b2cfa..3bb2968c 100644 --- a/sprout/algorithm/count_if.hpp +++ b/sprout/algorithm/count_if.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_if( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/algorithm/equal.hpp b/sprout/algorithm/equal.hpp index 3b13d9f1..b5ef4f0f 100644 --- a/sprout/algorithm/equal.hpp +++ b/sprout/algorithm/equal.hpp @@ -91,7 +91,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool equal( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::tuples::tuple type; diff --git a/sprout/algorithm/find.hpp b/sprout/algorithm/find.hpp index 0d041ba3..7acd117b 100644 --- a/sprout/algorithm/find.hpp +++ b/sprout/algorithm/find.hpp @@ -86,7 +86,7 @@ namespace sprout { inline SPROUT_CONSTEXPR InputIterator find( InputIterator first, InputIterator last, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/find_end.hpp b/sprout/algorithm/find_end.hpp index 04cb79cb..5da0066b 100644 --- a/sprout/algorithm/find_end.hpp +++ b/sprout/algorithm/find_end.hpp @@ -134,7 +134,7 @@ namespace sprout { ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/find_first_of.hpp b/sprout/algorithm/find_first_of.hpp index b889ad2e..060d234e 100644 --- a/sprout/algorithm/find_first_of.hpp +++ b/sprout/algorithm/find_first_of.hpp @@ -102,7 +102,7 @@ namespace sprout { InputIterator1 first1, InputIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/find_if.hpp b/sprout/algorithm/find_if.hpp index ffc8088c..e6356d97 100644 --- a/sprout/algorithm/find_if.hpp +++ b/sprout/algorithm/find_if.hpp @@ -86,7 +86,7 @@ namespace sprout { inline SPROUT_CONSTEXPR InputIterator find_if( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/find_if_not.hpp b/sprout/algorithm/find_if_not.hpp index 1676aa4a..0d97c045 100644 --- a/sprout/algorithm/find_if_not.hpp +++ b/sprout/algorithm/find_if_not.hpp @@ -86,7 +86,7 @@ namespace sprout { inline SPROUT_CONSTEXPR InputIterator find_if_not( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/fixed/clamp_range_copy.hpp b/sprout/algorithm/fixed/clamp_range_copy.hpp index de7d237d..6ef3c0be 100644 --- a/sprout/algorithm/fixed/clamp_range_copy.hpp +++ b/sprout/algorithm/fixed/clamp_range_copy.hpp @@ -105,7 +105,7 @@ namespace sprout { typename std::iterator_traits::value_type const& low, typename std::iterator_traits::value_type const& high, Compare comp, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::clamp_range_copy_impl(first, last, result, low, high, comp, sprout::size(result)); diff --git a/sprout/algorithm/fixed/copy.hpp b/sprout/algorithm/fixed/copy.hpp index 4fb3f6c3..5cb8b2e1 100644 --- a/sprout/algorithm/fixed/copy.hpp +++ b/sprout/algorithm/fixed/copy.hpp @@ -83,7 +83,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type copy( InputIterator first, InputIterator last, Result const& result, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::copy_impl(first, last, result, sprout::size(result)); diff --git a/sprout/algorithm/fixed/copy_backward.hpp b/sprout/algorithm/fixed/copy_backward.hpp index a21b74d3..98d35595 100644 --- a/sprout/algorithm/fixed/copy_backward.hpp +++ b/sprout/algorithm/fixed/copy_backward.hpp @@ -82,7 +82,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type copy_backward( BidirectionalIterator first, BidirectionalIterator last, Result const& result, - void* + std::bidirectional_iterator_tag* ) { return sprout::fixed::detail::copy_backward_impl( diff --git a/sprout/algorithm/fixed/copy_n.hpp b/sprout/algorithm/fixed/copy_n.hpp index 0aa27498..366b9c8d 100644 --- a/sprout/algorithm/fixed/copy_n.hpp +++ b/sprout/algorithm/fixed/copy_n.hpp @@ -59,7 +59,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type copy_n( InputIterator first, Size n, Result const& result, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::copy_n_impl(first, n, result, sprout::size(result)); diff --git a/sprout/algorithm/fixed/copy_until.hpp b/sprout/algorithm/fixed/copy_until.hpp index 7a1cab17..3f61db41 100644 --- a/sprout/algorithm/fixed/copy_until.hpp +++ b/sprout/algorithm/fixed/copy_until.hpp @@ -61,7 +61,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type copy_until( InputIterator first, InputIterator last, Result const& result, Predicate pred, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::copy_until_impl(first, last, result, pred, sprout::size(result)); diff --git a/sprout/algorithm/fixed/copy_while.hpp b/sprout/algorithm/fixed/copy_while.hpp index 12f4e13c..960fd971 100644 --- a/sprout/algorithm/fixed/copy_while.hpp +++ b/sprout/algorithm/fixed/copy_while.hpp @@ -60,7 +60,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type copy_while( InputIterator first, InputIterator last, Result const& result, Predicate pred, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::copy_while_impl(first, last, result, pred, sprout::size(result)); diff --git a/sprout/algorithm/fixed/replace_copy.hpp b/sprout/algorithm/fixed/replace_copy.hpp index c7ad9058..3aa425e7 100644 --- a/sprout/algorithm/fixed/replace_copy.hpp +++ b/sprout/algorithm/fixed/replace_copy.hpp @@ -93,7 +93,7 @@ namespace sprout { replace_copy( InputIterator first, InputIterator last, Result const& result, T const& old_value, T const& new_value, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::replace_copy_impl(first, last, result, old_value, new_value, sprout::size(result)); diff --git a/sprout/algorithm/fixed/replace_copy_if.hpp b/sprout/algorithm/fixed/replace_copy_if.hpp index 1227a1b1..e39cd701 100644 --- a/sprout/algorithm/fixed/replace_copy_if.hpp +++ b/sprout/algorithm/fixed/replace_copy_if.hpp @@ -92,7 +92,7 @@ namespace sprout { replace_copy_if( InputIterator first, InputIterator last, Result const& result, Predicate pred, T const& new_value, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::replace_copy_if_impl(first, last, result, pred, new_value, sprout::size(result)); diff --git a/sprout/algorithm/fixed/reverse_copy.hpp b/sprout/algorithm/fixed/reverse_copy.hpp index 26f128a5..9f69f8e1 100644 --- a/sprout/algorithm/fixed/reverse_copy.hpp +++ b/sprout/algorithm/fixed/reverse_copy.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type reverse_copy( BidirectionalIterator first, BidirectionalIterator last, Result const& result, - void* + std::bidirectional_iterator_tag* ) { return sprout::fixed::detail::reverse_copy_impl(first, last, result, sprout::size(result)); diff --git a/sprout/algorithm/fixed/rotate_copy.hpp b/sprout/algorithm/fixed/rotate_copy.hpp index 2e6fd008..9163859d 100644 --- a/sprout/algorithm/fixed/rotate_copy.hpp +++ b/sprout/algorithm/fixed/rotate_copy.hpp @@ -125,7 +125,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type rotate_copy( ForwardIterator first, ForwardIterator middle, ForwardIterator last, Result const& result, - void* + std::forward_iterator_tag* ) { return sprout::fixed::detail::rotate_copy_impl(first, middle, last, result, sprout::size(result)); diff --git a/sprout/algorithm/fixed/swap_element_copy.hpp b/sprout/algorithm/fixed/swap_element_copy.hpp index c1d1186e..675c13cd 100644 --- a/sprout/algorithm/fixed/swap_element_copy.hpp +++ b/sprout/algorithm/fixed/swap_element_copy.hpp @@ -102,7 +102,7 @@ namespace sprout { ForwardIterator first, ForwardIterator last, Result const& result, ForwardIterator pos1, ForwardIterator pos2, - void* + std::forward_iterator_tag* ) { return sprout::fixed::detail::swap_element_copy_impl(first, last, result, sprout::size(result)); diff --git a/sprout/algorithm/fixed/transform.hpp b/sprout/algorithm/fixed/transform.hpp index d9c88c3d..22b61c15 100644 --- a/sprout/algorithm/fixed/transform.hpp +++ b/sprout/algorithm/fixed/transform.hpp @@ -90,7 +90,7 @@ namespace sprout { transform( InputIterator first, InputIterator last, Result const& result, UnaryOperation op, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::transform_impl(first, last, result, op, sprout::size(result)); @@ -207,7 +207,7 @@ namespace sprout { transform( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Result const& result, BinaryOperation op, - void* + std::input_iterator_tag* ) { return sprout::fixed::detail::transform_impl(first1, last1, first2, result, op, sprout::size(result)); diff --git a/sprout/algorithm/includes.hpp b/sprout/algorithm/includes.hpp index d3564bce..bf0af765 100644 --- a/sprout/algorithm/includes.hpp +++ b/sprout/algorithm/includes.hpp @@ -99,7 +99,7 @@ namespace sprout { InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/is_partitioned.hpp b/sprout/algorithm/is_partitioned.hpp index 727f79b6..3a037e68 100644 --- a/sprout/algorithm/is_partitioned.hpp +++ b/sprout/algorithm/is_partitioned.hpp @@ -78,7 +78,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool is_partitioned( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/algorithm/is_permutation.hpp b/sprout/algorithm/is_permutation.hpp index f91d8557..8961e37d 100644 --- a/sprout/algorithm/is_permutation.hpp +++ b/sprout/algorithm/is_permutation.hpp @@ -99,7 +99,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool is_permutation( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/is_sorted.hpp b/sprout/algorithm/is_sorted.hpp index f7767eb5..6f69e56f 100644 --- a/sprout/algorithm/is_sorted.hpp +++ b/sprout/algorithm/is_sorted.hpp @@ -52,7 +52,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool is_sorted( ForwardIterator first, ForwardIterator last, Compare comp, - void* + std::forward_iterator_tag* ) { return sprout::is_sorted_until(first, last, comp) == last; diff --git a/sprout/algorithm/is_sorted_until.hpp b/sprout/algorithm/is_sorted_until.hpp index 537ce75b..ef46c92c 100644 --- a/sprout/algorithm/is_sorted_until.hpp +++ b/sprout/algorithm/is_sorted_until.hpp @@ -94,7 +94,7 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator is_sorted_until( ForwardIterator first, ForwardIterator last, Compare comp, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/lexicographical_compare.hpp b/sprout/algorithm/lexicographical_compare.hpp index bbd7d081..fcc23f47 100644 --- a/sprout/algorithm/lexicographical_compare.hpp +++ b/sprout/algorithm/lexicographical_compare.hpp @@ -126,7 +126,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool lexicographical_compare( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/max_element.hpp b/sprout/algorithm/max_element.hpp index aa1a2a56..37d1ad7c 100644 --- a/sprout/algorithm/max_element.hpp +++ b/sprout/algorithm/max_element.hpp @@ -97,7 +97,7 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator max_element( ForwardIterator first, ForwardIterator last, Compare comp, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/min_element.hpp b/sprout/algorithm/min_element.hpp index 89ba91e1..7523168f 100644 --- a/sprout/algorithm/min_element.hpp +++ b/sprout/algorithm/min_element.hpp @@ -97,7 +97,7 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator min_element( ForwardIterator first, ForwardIterator last, Compare comp, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/minmax_element.hpp b/sprout/algorithm/minmax_element.hpp index 39a92df2..10417972 100644 --- a/sprout/algorithm/minmax_element.hpp +++ b/sprout/algorithm/minmax_element.hpp @@ -109,7 +109,7 @@ namespace sprout { inline SPROUT_CONSTEXPR sprout::pair minmax_element( ForwardIterator first, ForwardIterator last, Compare comp, - void* + std::forward_iterator_tag* ) { typedef sprout::pair > type; diff --git a/sprout/algorithm/mismatch.hpp b/sprout/algorithm/mismatch.hpp index 99179331..0463a502 100644 --- a/sprout/algorithm/mismatch.hpp +++ b/sprout/algorithm/mismatch.hpp @@ -112,7 +112,7 @@ namespace sprout { inline SPROUT_CONSTEXPR sprout::pair mismatch( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::tuples::tuple type; diff --git a/sprout/algorithm/none_of.hpp b/sprout/algorithm/none_of.hpp index 2548da8e..6cfae9aa 100644 --- a/sprout/algorithm/none_of.hpp +++ b/sprout/algorithm/none_of.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool none_of( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/none_of_equal.hpp b/sprout/algorithm/none_of_equal.hpp index e8a851c2..edaa2165 100644 --- a/sprout/algorithm/none_of_equal.hpp +++ b/sprout/algorithm/none_of_equal.hpp @@ -84,7 +84,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool none_of_equal( InputIterator first, InputIterator last, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/one_of.hpp b/sprout/algorithm/one_of.hpp index 016d972c..60fd6283 100644 --- a/sprout/algorithm/one_of.hpp +++ b/sprout/algorithm/one_of.hpp @@ -108,7 +108,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool one_of( InputIterator first, InputIterator last, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/algorithm/one_of_equal.hpp b/sprout/algorithm/one_of_equal.hpp index 0309b9af..094d702d 100644 --- a/sprout/algorithm/one_of_equal.hpp +++ b/sprout/algorithm/one_of_equal.hpp @@ -108,7 +108,7 @@ namespace sprout { inline SPROUT_CONSTEXPR bool one_of_equal( InputIterator first, InputIterator last, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/algorithm/search.hpp b/sprout/algorithm/search.hpp index 8fa3f1dd..8941216e 100644 --- a/sprout/algorithm/search.hpp +++ b/sprout/algorithm/search.hpp @@ -110,7 +110,7 @@ namespace sprout { ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred, - void* + std::forward_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/algorithm/search_n.hpp b/sprout/algorithm/search_n.hpp index 7bc5db81..408117e3 100644 --- a/sprout/algorithm/search_n.hpp +++ b/sprout/algorithm/search_n.hpp @@ -18,9 +18,10 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator search_n(ForwardIterator first, ForwardIterator last, Size count, T const& value, BinaryPredicate pred) { typedef sprout::value_iterator iterator; + typedef typename std::iterator_traits::difference_type difference_type; return sprout::search( first, last, - iterator(value, static_cast::difference_type>(count)), iterator(value, 0), + iterator(value, static_cast(count)), iterator(value, 0), pred ); } diff --git a/sprout/algorithm/tristate_lexicographical_compare.hpp b/sprout/algorithm/tristate_lexicographical_compare.hpp index af41d638..ba96c174 100644 --- a/sprout/algorithm/tristate_lexicographical_compare.hpp +++ b/sprout/algorithm/tristate_lexicographical_compare.hpp @@ -129,7 +129,7 @@ namespace sprout { inline SPROUT_CONSTEXPR int tristate_lexicographical_compare( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; @@ -298,7 +298,7 @@ namespace sprout { InputIterator1 first1, InputIterator1 last1, T1 const& delim1, InputIterator2 first2, InputIterator2 last2, T2 const& delim2, Compare comp, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/detail/algorithm/count_n.hpp b/sprout/detail/algorithm/count_n.hpp index b032c2d5..3f26f3ce 100644 --- a/sprout/detail/algorithm/count_n.hpp +++ b/sprout/detail/algorithm/count_n.hpp @@ -46,7 +46,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_n( InputIterator first, typename std::iterator_traits::difference_type n, T const& value, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/detail/algorithm/count_n_if.hpp b/sprout/detail/algorithm/count_n_if.hpp index 791477e7..d7cb6404 100644 --- a/sprout/detail/algorithm/count_n_if.hpp +++ b/sprout/detail/algorithm/count_n_if.hpp @@ -46,7 +46,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_n_if( InputIterator first, typename std::iterator_traits::difference_type n, Predicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::pair::difference_type> type; diff --git a/sprout/detail/algorithm/overlap_count.hpp b/sprout/detail/algorithm/overlap_count.hpp index ca149a89..2323a4bf 100644 --- a/sprout/detail/algorithm/overlap_count.hpp +++ b/sprout/detail/algorithm/overlap_count.hpp @@ -91,7 +91,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count( InputIterator first, InputIterator last, BinaryPredicate pred, - void* + std::input_iterator_tag* ) { typedef sprout::tuples::tuple::value_type, typename std::iterator_traits::difference_type> type; diff --git a/sprout/detail/algorithm/search_one.hpp b/sprout/detail/algorithm/search_one.hpp index 16ef1ca1..6c9eddb5 100644 --- a/sprout/detail/algorithm/search_one.hpp +++ b/sprout/detail/algorithm/search_one.hpp @@ -86,7 +86,7 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator1 search_one( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred, - void* + std::forward_iterator_tag* ) { typedef sprout::tuples::tuple type; diff --git a/sprout/iterator/bytes_iterator.hpp b/sprout/iterator/bytes_iterator.hpp index a4ef983b..23a52899 100644 --- a/sprout/iterator/bytes_iterator.hpp +++ b/sprout/iterator/bytes_iterator.hpp @@ -28,7 +28,7 @@ namespace sprout { > { public: - typedef Iterator base_type; + typedef Iterator iterator_type; typedef Traits traits_type; private: typedef std::iterator< @@ -37,34 +37,34 @@ namespace sprout { std::ptrdiff_t, void, unsigned char - > iterator_type; + > base_type; public: - typedef typename iterator_type::iterator_category iterator_category; - typedef typename iterator_type::value_type value_type; - typedef typename iterator_type::difference_type difference_type; - typedef typename iterator_type::pointer pointer; - typedef typename iterator_type::reference reference; + typedef typename base_type::iterator_category iterator_category; + typedef typename base_type::value_type value_type; + typedef typename base_type::difference_type difference_type; + typedef typename base_type::pointer pointer; + typedef typename base_type::reference reference; private: struct next_tag {}; struct prev_tag {}; struct ra_tag {}; private: - base_type it_; + iterator_type it_; difference_type i_; private: - SPROUT_CONSTEXPR bytes_iterator(base_type it, difference_type i) + SPROUT_CONSTEXPR bytes_iterator(iterator_type it, difference_type i) : it_(it) , i_(i) {} - SPROUT_CONSTEXPR bytes_iterator(base_type it, difference_type i, next_tag) + SPROUT_CONSTEXPR bytes_iterator(iterator_type it, difference_type i, next_tag) : it_(i / traits_type::size() == 0 ? it : sprout::next(it)) , i_(i % traits_type::size()) {} - SPROUT_CONSTEXPR bytes_iterator(base_type it, difference_type i, prev_tag) + SPROUT_CONSTEXPR bytes_iterator(iterator_type it, difference_type i, prev_tag) : it_((i + 1 - traits_type::size()) / traits_type::size() == 0 ? it : sprout::prev(it)) , i_(i % traits_type::size() + traits_type::size()) {} - SPROUT_CONSTEXPR bytes_iterator(base_type it, difference_type i, ra_tag) + SPROUT_CONSTEXPR bytes_iterator(iterator_type it, difference_type i, ra_tag) : it_(i >= 0 ? sprout::next(it, i / traits_type::size()) : sprout::next(it, (i + 1 - traits_type::size()) / traits_type::size()) @@ -76,14 +76,18 @@ namespace sprout { {} public: SPROUT_CONSTEXPR bytes_iterator() - : it_() - , i_() + : it_(), i_() {} bytes_iterator(bytes_iterator const&) = default; - explicit SPROUT_CONSTEXPR bytes_iterator(base_type it) - : it_(it) - , i_() + explicit SPROUT_CONSTEXPR bytes_iterator(iterator_type it) + : it_(it), i_() {} + SPROUT_CONSTEXPR iterator_type const& base() const { + return it_; + } + SPROUT_CONSTEXPR difference_type index() const { + return i_; + } SPROUT_CONSTEXPR bytes_iterator next() const { return bytes_iterator(it_, i_ + 1, next_tag()); } @@ -96,24 +100,6 @@ namespace sprout { sprout::swap(it_, other.it_); sprout::swap(i_, other.i_); } - friend SPROUT_CONSTEXPR bool operator==(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return lhs.it_ == rhs.it_ && lhs.i_ == rhs.i_; - } - friend SPROUT_CONSTEXPR bool operator!=(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return lhs.it_ < rhs.it_ || (lhs.it_ == rhs.it_ && lhs.i_ < rhs.i_); - } - friend SPROUT_CONSTEXPR bool operator>(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return !(lhs < rhs); - } SPROUT_CONSTEXPR reference operator*() const { return traits_type::get_byte(*it_, i_); } @@ -156,14 +142,60 @@ namespace sprout { SPROUT_CONSTEXPR reference operator[](difference_type n) const { return *(*this + n); } - friend SPROUT_CONSTEXPR difference_type operator-(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return (lhs.it_ - rhs.it_) * traits_type::size() + (lhs.i_ - rhs.i_); - } - friend SPROUT_CONSTEXPR bytes_iterator operator+(difference_type n, bytes_iterator const& it) { - return it + n; - } }; + template + inline SPROUT_CONSTEXPR bool + operator==(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return lhs.base() == rhs.base() && lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator!=(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR bool + operator<(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return lhs.base() < rhs.base() || (lhs.base() == rhs.base() && lhs.index() < rhs.index()); + } + template + inline SPROUT_CONSTEXPR bool + operator>(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR bool + operator<=(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR bool + operator>=(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR decltype(std::declval() - std::declval()) + operator-(sprout::bytes_iterator const& lhs, sprout::bytes_iterator const& rhs) { + return (lhs.base() - rhs.base()) * Traits::size() + (lhs.index() - rhs.index()); + } + template + inline SPROUT_CONSTEXPR sprout::bytes_iterator + operator+(typename sprout::bytes_iterator::difference_type n, sprout::bytes_iterator const& it) { + return it + n; + } + + // + // swap + // + template + inline void + swap(sprout::bytes_iterator& lhs, sprout::bytes_iterator& rhs) + SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) + { + lhs.swap(rhs); + } + // // make_bytes_iterator // @@ -179,14 +211,18 @@ namespace sprout { } // - // swap + // make_big_bytes_iterator + // make_little_bytes_iterator // - template - inline void - swap(sprout::bytes_iterator& lhs, sprout::bytes_iterator& rhs) - SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) - { - lhs.swap(rhs); + template + inline SPROUT_CONSTEXPR sprout::bytes_iterator::value_type> > + make_big_bytes_iterator(Iterator it) { + return sprout::bytes_iterator::value_type> >(it); + } + template + inline SPROUT_CONSTEXPR sprout::bytes_iterator::value_type> > + make_little_bytes_iterator(Iterator it) { + return sprout::bytes_iterator::value_type> >(it); } // diff --git a/sprout/iterator/dft_iterator.hpp b/sprout/iterator/dft_iterator.hpp index baff8a02..c270b37f 100644 --- a/sprout/iterator/dft_iterator.hpp +++ b/sprout/iterator/dft_iterator.hpp @@ -76,24 +76,6 @@ namespace sprout { sprout::swap(index_, other.index_); sprout::swap(size_, other.size_); } - friend SPROUT_CONSTEXPR bool operator==(dft_iterator const& lhs, dft_iterator const& rhs) { - return lhs.index_ == rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator!=(dft_iterator const& lhs, dft_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(dft_iterator const& lhs, dft_iterator const& rhs) { - return lhs.index_ < rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator>(dft_iterator const& lhs, dft_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(dft_iterator const& lhs, dft_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(dft_iterator const& lhs, dft_iterator const& rhs) { - return !(lhs < rhs); - } SPROUT_CONSTEXPR reference operator*() const { return sprout::detail::dft_element_impl(first_, last_, index_, size_); } @@ -136,14 +118,49 @@ namespace sprout { SPROUT_CONSTEXPR reference operator[](difference_type n) const { return sprout::detail::dft_element_impl(first_, last_, index_ + n, size_); } - friend SPROUT_CONSTEXPR difference_type operator-(dft_iterator const& lhs, dft_iterator const& rhs) { - return lhs.index_ - rhs.index_; - } - friend SPROUT_CONSTEXPR dft_iterator operator+(difference_type n, dft_iterator const& it) { - return it + n; - } }; + template + inline SPROUT_CONSTEXPR bool + operator==(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator!=(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR bool + operator<(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return lhs.index_ < rhs.index_; + } + template + inline SPROUT_CONSTEXPR bool + operator>(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR bool + operator<=(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR bool + operator>=(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR typename sprout::dft_iterator::difference_type + operator-(sprout::dft_iterator const& lhs, sprout::dft_iterator const& rhs) { + return lhs.index() - rhs.index(); + } + template + inline SPROUT_CONSTEXPR sprout::dft_iterator + operator+(typename sprout::dft_iterator::difference_type n, sprout::dft_iterator const& it) { + return it + n; + } + // // make_dft_iterator // diff --git a/sprout/iterator/distance.hpp b/sprout/iterator/distance.hpp index f65e9404..e66559a2 100644 --- a/sprout/iterator/distance.hpp +++ b/sprout/iterator/distance.hpp @@ -63,7 +63,7 @@ namespace sprout { } template inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type - iterator_distance(InputIterator first, InputIterator last, void*) { + iterator_distance(InputIterator first, InputIterator last, std::input_iterator_tag*) { typedef sprout::pair::difference_type> type; return sprout::iterator_detail::iterator_distance_impl(type(first, 0), last, 1).second; } diff --git a/sprout/iterator/generator_iterator.hpp b/sprout/iterator/generator_iterator.hpp index 5e3387db..25890ad5 100644 --- a/sprout/iterator/generator_iterator.hpp +++ b/sprout/iterator/generator_iterator.hpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -34,16 +33,16 @@ namespace sprout { typedef value_type* pointer; private: generator_type gen_; - difference_type count_; + difference_type index_; public: SPROUT_CONSTEXPR generator_iterator() - : gen_(), count_() + : gen_(), index_() {} explicit SPROUT_CONSTEXPR generator_iterator( generator_type const& gen, - difference_type count = std::numeric_limits::max() + difference_type index = std::numeric_limits::max() ) - : gen_(gen), count_(count) + : gen_(gen), index_(index) {} generator_type& generator() { return gen_; @@ -51,14 +50,11 @@ namespace sprout { SPROUT_CONSTEXPR generator_type const& generator() const { return gen_; } - SPROUT_CONSTEXPR difference_type count() const { - return count_; + SPROUT_CONSTEXPR difference_type index() const { + return index_; } SPROUT_CONSTEXPR generator_iterator operator()() const { - return count_ != 0 - ? generator_iterator(sprout::generators::next_generator(gen_)(), count_ > 0 ? count_ - 1 : count_) - : throw std::out_of_range("generator_iterator<>: increment at out of range") - ; + return generator_iterator(sprout::generators::next_generator(gen_)(), index_ - 1); } SPROUT_CONSTEXPR generator_iterator next() const { return (*this)(); @@ -73,35 +69,10 @@ namespace sprout { SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(gen_, other.gen_))) { sprout::swap(gen_, other.gen_); - sprout::swap(count_, other.count_); - } - friend SPROUT_CONSTEXPR bool operator==(generator_iterator const& lhs, generator_iterator const& rhs) { - return lhs.count_ == rhs.count_; - } - friend SPROUT_CONSTEXPR bool operator!=(generator_iterator const& lhs, generator_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(generator_iterator const& lhs, generator_iterator const& rhs) { - typedef typename std::make_unsigned::type unsigned_type; - return static_cast(lhs.count_) > static_cast(rhs.count_); - } - friend SPROUT_CONSTEXPR bool operator>(generator_iterator const& lhs, generator_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(generator_iterator const& lhs, generator_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(generator_iterator const& lhs, generator_iterator const& rhs) { - return !(lhs < rhs); + sprout::swap(index_, other.index_); } SPROUT_CONSTEXPR reference operator*() const { - return count_ != 0 - ? sprout::generators::generated_value(gen_) - : ( - throw std::out_of_range("generator_iterator<>: dereference at out of range"), - sprout::generators::generated_value(gen_) - ) - ; + return sprout::generators::generated_value(gen_); } SPROUT_CONSTEXPR pointer operator->() const { return &*(*this); @@ -116,11 +87,44 @@ namespace sprout { ++*this; return result; } - friend SPROUT_CONSTEXPR difference_type operator-(generator_iterator const& lhs, generator_iterator const& rhs) { - return rhs.count_ - lhs.count_; - } }; + template + inline SPROUT_CONSTEXPR bool + operator==(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator!=(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR bool + operator<(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return rhs.index() < lhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator>(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR bool + operator<=(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR bool + operator>=(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR typename sprout::generator_iterator::difference_type + operator-(sprout::generator_iterator const& lhs, sprout::generator_iterator const& rhs) { + return rhs.index() - lhs.index(); + } + // // swap // diff --git a/sprout/iterator/idft_iterator.hpp b/sprout/iterator/idft_iterator.hpp index a3949897..2ce5d95f 100644 --- a/sprout/iterator/idft_iterator.hpp +++ b/sprout/iterator/idft_iterator.hpp @@ -76,24 +76,6 @@ namespace sprout { sprout::swap(index_, other.index_); sprout::swap(size_, other.size_); } - friend SPROUT_CONSTEXPR bool operator==(idft_iterator const& lhs, idft_iterator const& rhs) { - return lhs.index_ == rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator!=(idft_iterator const& lhs, idft_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(idft_iterator const& lhs, idft_iterator const& rhs) { - return lhs.index_ < rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator>(idft_iterator const& lhs, idft_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(idft_iterator const& lhs, idft_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(idft_iterator const& lhs, idft_iterator const& rhs) { - return !(lhs < rhs); - } SPROUT_CONSTEXPR reference operator*() const { return sprout::detail::idft_element_impl(first_, last_, index_, size_); } @@ -136,14 +118,49 @@ namespace sprout { SPROUT_CONSTEXPR reference operator[](difference_type n) const { return sprout::detail::idft_element_impl(first_, last_, index_ + n, size_); } - friend SPROUT_CONSTEXPR difference_type operator-(idft_iterator const& lhs, idft_iterator const& rhs) { - return lhs.index_ - rhs.index_; - } - friend SPROUT_CONSTEXPR idft_iterator operator+(difference_type n, idft_iterator const& it) { - return it + n; - } }; + template + inline SPROUT_CONSTEXPR bool + operator==(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator!=(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR bool + operator<(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return lhs.index_ < rhs.index_; + } + template + inline SPROUT_CONSTEXPR bool + operator>(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR bool + operator<=(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR bool + operator>=(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR typename sprout::idft_iterator::difference_type + operator-(sprout::idft_iterator const& lhs, sprout::idft_iterator const& rhs) { + return lhs.index() - rhs.index(); + } + template + inline SPROUT_CONSTEXPR sprout::idft_iterator + operator+(typename sprout::idft_iterator::difference_type n, sprout::idft_iterator const& it) { + return it + n; + } + // // make_idft_iterator // diff --git a/sprout/iterator/index_iterator.hpp b/sprout/iterator/index_iterator.hpp index 92432954..cf95dd25 100644 --- a/sprout/iterator/index_iterator.hpp +++ b/sprout/iterator/index_iterator.hpp @@ -78,25 +78,21 @@ namespace sprout { typedef typename traits_type::size_type size_type; private: holder_type holder_; - size_type index_; + difference_type index_; private: - SPROUT_CONSTEXPR index_iterator(holder_type const& r, size_type index) - : holder_(r) - , index_(index) + SPROUT_CONSTEXPR index_iterator(holder_type const& r, difference_type index) + : holder_(r), index_(index) {} public: SPROUT_CONSTEXPR index_iterator() - : holder_() - , index_() + : holder_(), index_() {} index_iterator(index_iterator const&) = default; explicit SPROUT_CONSTEXPR index_iterator(typename holder_type::param_type p) - : holder_(p) - , index_(0) + : holder_(p), index_(0) {} - SPROUT_CONSTEXPR index_iterator(typename holder_type::param_type p, size_type index) - : holder_(p) - , index_(index) + SPROUT_CONSTEXPR index_iterator(typename holder_type::param_type p, difference_type index) + : holder_(p), index_(index) {} operator index_iterator() const { return index_iterator(holder_.get(), index_); @@ -104,7 +100,7 @@ namespace sprout { SPROUT_CONSTEXPR typename holder_type::mutable_or_const_reference base() const { return holder_.get(); } - SPROUT_CONSTEXPR size_type index() const { + SPROUT_CONSTEXPR difference_type index() const { return index_; } SPROUT_CONSTEXPR index_iterator next() const { @@ -119,24 +115,6 @@ namespace sprout { sprout::swap(holder_, other.holder_); sprout::swap(index_, other.index_); } - friend SPROUT_CONSTEXPR bool operator==(index_iterator const& lhs, index_iterator const& rhs) { - return lhs.index_ == rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator!=(index_iterator const& lhs, index_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(index_iterator const& lhs, index_iterator const& rhs) { - return lhs.index_ < rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator>(index_iterator const& lhs, index_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(index_iterator const& lhs, index_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(index_iterator const& lhs, index_iterator const& rhs) { - return !(lhs < rhs); - } SPROUT_CONSTEXPR reference operator*() const { return holder_.get()[index_]; } @@ -182,14 +160,73 @@ namespace sprout { SPROUT_CONSTEXPR reference operator[](difference_type n) const { return holder_.get()[index_ + n]; } - friend SPROUT_CONSTEXPR difference_type operator-(index_iterator const& lhs, index_iterator const& rhs) { - return static_cast(lhs.index_) - static_cast(rhs.index_); - } - friend SPROUT_CONSTEXPR index_iterator operator+(difference_type n, index_iterator const& it) { - return it + n; - } }; + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator==(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator!=(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator<(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return lhs.index() < rhs.index(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator>(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator<=(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator>=(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + decltype( + std::declval >::difference_type>() + - std::declval >::difference_type>() + ) + >::type + operator-(sprout::index_iterator const& lhs, sprout::index_iterator const& rhs) { + return lhs.index() - rhs.index(); + } + template + inline SPROUT_CONSTEXPR sprout::index_iterator + operator+(typename sprout::index_iterator::difference_type n, sprout::index_iterator const& it) { + return it + n; + } + // // swap // diff --git a/sprout/iterator/next.hpp b/sprout/iterator/next.hpp index 3d74f2ee..e72ddc34 100644 --- a/sprout/iterator/next.hpp +++ b/sprout/iterator/next.hpp @@ -25,7 +25,7 @@ namespace sprout { } template inline SPROUT_CONSTEXPR ForwardIterator - next_impl(ForwardIterator const& it, void*) { + next_impl(ForwardIterator const& it, std::forward_iterator_tag*) { return std::next(it); } @@ -79,7 +79,7 @@ namespace sprout { inline SPROUT_CONSTEXPR ForwardIterator next_impl_1( ForwardIterator const& it, typename std::iterator_traits::difference_type n, - void* + std::forward_iterator_tag* ) { return n == 0 ? it @@ -95,7 +95,7 @@ namespace sprout { >::type next_impl( ForwardIterator const& it, typename std::iterator_traits::difference_type n, - void* + std::forward_iterator_tag* ) { typedef typename std::iterator_traits::iterator_category* category; @@ -108,7 +108,7 @@ namespace sprout { >::type next_impl( ForwardIterator const& it, typename std::iterator_traits::difference_type n, - void* + std::forward_iterator_tag* ) { return std::next(it, n); diff --git a/sprout/iterator/prev.hpp b/sprout/iterator/prev.hpp index 4dd65906..48794810 100644 --- a/sprout/iterator/prev.hpp +++ b/sprout/iterator/prev.hpp @@ -24,7 +24,7 @@ namespace sprout { } template inline SPROUT_CONSTEXPR BidirectionalIterator - prev_impl(BidirectionalIterator const& it, void*) { + prev_impl(BidirectionalIterator const& it, std::bidirectional_iterator_tag*) { return std::prev(it); } @@ -69,7 +69,7 @@ namespace sprout { >::type prev_impl( BidirectionalIterator const& it, typename std::iterator_traits::difference_type n, - void* + std::bidirectional_iterator_tag* ) { return n == 0 ? it @@ -84,7 +84,7 @@ namespace sprout { >::type prev_impl( BidirectionalIterator const& it, typename std::iterator_traits::difference_type n, - void* + std::bidirectional_iterator_tag* ) { return std::prev(it, n); diff --git a/sprout/iterator/ptr_index_iterator.hpp b/sprout/iterator/ptr_index_iterator.hpp index 5f6ff3af..d4375dd7 100644 --- a/sprout/iterator/ptr_index_iterator.hpp +++ b/sprout/iterator/ptr_index_iterator.hpp @@ -52,17 +52,14 @@ namespace sprout { difference_type index_; public: SPROUT_CONSTEXPR ptr_index_iterator() - : p_() - , index_() + : p_(), index_() {} ptr_index_iterator(ptr_index_iterator const&) = default; explicit SPROUT_CONSTEXPR ptr_index_iterator(pointer p) - : p_(p) - , index_(0) + : p_(p), index_(0) {} SPROUT_CONSTEXPR ptr_index_iterator(pointer p, difference_type index) - : p_(p) - , index_(index) + : p_(p), index_(index) {} operator ptr_index_iterator() const { return ptr_index_iterator(p_, index_); @@ -88,24 +85,6 @@ namespace sprout { sprout::swap(p_, other.p_); sprout::swap(index_, other.index_); } - friend SPROUT_CONSTEXPR bool operator==(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return lhs.index_ == rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator!=(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return lhs.index_ < rhs.index_; - } - friend SPROUT_CONSTEXPR bool operator>(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return !(lhs < rhs); - } SPROUT_CONSTEXPR reference operator*() const { return p_[index_]; } @@ -151,14 +130,73 @@ namespace sprout { SPROUT_CONSTEXPR reference operator[](difference_type n) const { return p_[index_ + n]; } - friend SPROUT_CONSTEXPR difference_type operator-(ptr_index_iterator const& lhs, ptr_index_iterator const& rhs) { - return lhs.index_ - rhs.index_; - } - friend SPROUT_CONSTEXPR ptr_index_iterator operator+(difference_type n, ptr_index_iterator const& it) { - return it + n; - } }; + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator==(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator!=(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator<(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return lhs.index() < rhs.index(); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator>(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator<=(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + bool + >::type + operator>=(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + std::is_same::type, typename std::decay::type>::value, + decltype( + std::declval >::difference_type>() + - std::declval >::difference_type>() + ) + >::type + operator-(sprout::ptr_index_iterator const& lhs, sprout::ptr_index_iterator const& rhs) { + return lhs.index() - rhs.index(); + } + template + inline SPROUT_CONSTEXPR sprout::ptr_index_iterator + operator+(typename sprout::ptr_index_iterator::difference_type n, sprout::ptr_index_iterator const& it) { + return it + n; + } + // // swap // diff --git a/sprout/iterator/value_iterator.hpp b/sprout/iterator/value_iterator.hpp index 04eb0ed2..00747288 100644 --- a/sprout/iterator/value_iterator.hpp +++ b/sprout/iterator/value_iterator.hpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -51,66 +50,45 @@ namespace sprout { typedef typename base_type::reference reference; private: sprout::value_holder holder_; - difference_type count_; + difference_type index_; private: - SPROUT_CONSTEXPR value_iterator(sprout::value_holder const& r, difference_type count) - : holder_(r), count_(count) + SPROUT_CONSTEXPR value_iterator(sprout::value_holder const& r, difference_type index) + : holder_(r), index_(index) {} public: SPROUT_CONSTEXPR value_iterator() - : holder_(), count_() + : holder_(), index_() {} value_iterator(value_iterator const&) = default; explicit SPROUT_CONSTEXPR value_iterator( typename sprout::value_holder::param_type p, - difference_type count = std::numeric_limits::max() + difference_type index = std::numeric_limits::max() ) - : holder_(p), count_(count) + : holder_(p), index_(index) {} operator value_iterator() const { - return value_iterator(holder_.get(), count_); + return value_iterator(holder_.get(), index_); + } + SPROUT_CONSTEXPR difference_type index() const { + return index_; } SPROUT_CONSTEXPR value_iterator next() const { - return value_iterator(holder_, count_ != 0 ? count_ - 1 : count_); + return value_iterator(holder_, index_ - 1); } SPROUT_CONSTEXPR value_iterator prev() const { - return value_iterator(holder_, count_ != 0 ? count_ + 1 : count_); + return value_iterator(holder_, index_ + 1); } void swap(value_iterator& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(holder_, other.holder_))) { sprout::swap(holder_, other.holder_); - sprout::swap(count_, other.count_); - } - friend SPROUT_CONSTEXPR bool operator==(value_iterator const& lhs, value_iterator const& rhs) { - return lhs.count_ == rhs.count_ && (lhs.count_ == 0 || lhs.holder_.get() == rhs.holder_.get()); - } - friend SPROUT_CONSTEXPR bool operator!=(value_iterator const& lhs, value_iterator const& rhs) { - return !(lhs == rhs); - } - friend SPROUT_CONSTEXPR bool operator<(value_iterator const& lhs, value_iterator const& rhs) { - return lhs.count_ > rhs.count_; - } - friend SPROUT_CONSTEXPR bool operator>(value_iterator const& lhs, value_iterator const& rhs) { - return rhs < lhs; - } - friend SPROUT_CONSTEXPR bool operator<=(value_iterator const& lhs, value_iterator const& rhs) { - return !(rhs < lhs); - } - friend SPROUT_CONSTEXPR bool operator>=(value_iterator const& lhs, value_iterator const& rhs) { - return !(lhs < rhs); + sprout::swap(index_, other.index_); } SPROUT_CONSTEXPR reference operator*() const { - return count_ != 0 - ? holder_.get() - : (throw std::out_of_range("value_iterator<>: dereference at out of range"), holder_.get()) - ; + return holder_.get(); } SPROUT_CONSTEXPR pointer operator->() const { - return count_ != 0 - ? holder_.get_pointer() - : throw std::out_of_range("value_iterator<>: dereference at out of range") - ; + return holder_.get_pointer(); } value_iterator& operator++() { value_iterator temp(next()); @@ -133,32 +111,67 @@ namespace sprout { return result; } SPROUT_CONSTEXPR value_iterator operator+(difference_type n) const { - return value_iterator(holder_, count_ - n); + return value_iterator(holder_, index_ - n); } SPROUT_CONSTEXPR value_iterator operator-(difference_type n) const { - return value_iterator(holder_, count_ + n); + return value_iterator(holder_, index_ + n); } value_iterator& operator+=(difference_type n) { - value_iterator temp(holder_, count_ - n); + value_iterator temp(holder_, index_ - n); temp.swap(*this); return *this; } value_iterator& operator-=(difference_type n) { - value_iterator temp(holder_, count_ + n); + value_iterator temp(holder_, index_ + n); temp.swap(*this); return *this; } SPROUT_CONSTEXPR reference operator[](difference_type n) const { return holder_.get(); } - friend SPROUT_CONSTEXPR difference_type operator-(value_iterator const& lhs, value_iterator const& rhs) { - return rhs.count_ - lhs.count_; - } - friend SPROUT_CONSTEXPR value_iterator operator+(difference_type n, value_iterator const& it) { - return it + n; - } }; + template + inline SPROUT_CONSTEXPR bool + operator==(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return lhs.index() == rhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator!=(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return !(lhs == rhs); + } + template + inline SPROUT_CONSTEXPR bool + operator<(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return rhs.index() < lhs.index(); + } + template + inline SPROUT_CONSTEXPR bool + operator>(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return rhs < lhs; + } + template + inline SPROUT_CONSTEXPR bool + operator<=(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return !(rhs < lhs); + } + template + inline SPROUT_CONSTEXPR bool + operator>=(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return !(lhs < rhs); + } + template + inline SPROUT_CONSTEXPR typename sprout::value_iterator::difference_type + operator-(sprout::value_iterator const& lhs, sprout::value_iterator const& rhs) { + return rhs.index() - lhs.index(); + } + template + inline SPROUT_CONSTEXPR sprout::value_iterator + operator+(typename sprout::value_iterator::difference_type n, sprout::value_iterator const& it) { + return it + n; + } + // // swap // diff --git a/sprout/numeric/accumulate.hpp b/sprout/numeric/accumulate.hpp index 13941078..c23ec1f2 100644 --- a/sprout/numeric/accumulate.hpp +++ b/sprout/numeric/accumulate.hpp @@ -90,7 +90,7 @@ namespace sprout { inline SPROUT_CONSTEXPR T accumulate( InputIterator first, InputIterator last, T init, BinaryOperation binary_op, - void* + std::input_iterator_tag* ) { typedef sprout::pair type; diff --git a/sprout/numeric/dft/detail/dft_element_gen.hpp b/sprout/numeric/dft/detail/dft_element_gen.hpp index 1312e300..1a08fd4c 100644 --- a/sprout/numeric/dft/detail/dft_element_gen.hpp +++ b/sprout/numeric/dft/detail/dft_element_gen.hpp @@ -75,7 +75,7 @@ namespace sprout { dft_element_gen_impl( InputIterator first, InputIterator last, typename std::iterator_traits::value_type::value_type arg, - void* + std::input_iterator_tag* ) { return sprout::detail::dft_element_gen_impl_1(first, last, arg); diff --git a/sprout/numeric/dft/fixed/amplitude_spectrum.hpp b/sprout/numeric/dft/fixed/amplitude_spectrum.hpp index 33a39295..d3a61ca8 100644 --- a/sprout/numeric/dft/fixed/amplitude_spectrum.hpp +++ b/sprout/numeric/dft/fixed/amplitude_spectrum.hpp @@ -88,7 +88,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type amplitude_spectrum( ForwardIterator first, ForwardIterator last, Result const& result, - void* + std::forward_iterator_tag* ) { return sprout::fixed::detail::amplitude_spectrum_impl(first, last, result, sprout::size(result)); diff --git a/sprout/numeric/dft/fixed/dft.hpp b/sprout/numeric/dft/fixed/dft.hpp index 40742cc5..6d02ae43 100644 --- a/sprout/numeric/dft/fixed/dft.hpp +++ b/sprout/numeric/dft/fixed/dft.hpp @@ -90,7 +90,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type dft( ForwardIterator first, ForwardIterator last, Result const& result, - void* + std::forward_iterator_tag* ) { return sprout::fixed::detail::dft_impl(first, last, result, sprout::size(result), first, 0); diff --git a/sprout/numeric/dft/fixed/idft.hpp b/sprout/numeric/dft/fixed/idft.hpp index bf0576a6..efb9b7df 100644 --- a/sprout/numeric/dft/fixed/idft.hpp +++ b/sprout/numeric/dft/fixed/idft.hpp @@ -90,7 +90,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type idft( ForwardIterator first, ForwardIterator last, Result const& result, - void* + std::forward_iterator_tag* ) { return sprout::fixed::detail::idft_impl(first, last, result, sprout::size(result), first, 0); diff --git a/sprout/numeric/dft/fixed/phase_spectrum.hpp b/sprout/numeric/dft/fixed/phase_spectrum.hpp index 88d69a5d..720c4612 100644 --- a/sprout/numeric/dft/fixed/phase_spectrum.hpp +++ b/sprout/numeric/dft/fixed/phase_spectrum.hpp @@ -88,7 +88,7 @@ namespace sprout { inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type phase_spectrum( ForwardIterator first, ForwardIterator last, Result const& result, - void* + std::forward_iterator_tag* ) { return sprout::fixed::detail::phase_spectrum_impl(first, last, result, sprout::size(result)); diff --git a/sprout/numeric/inner_product.hpp b/sprout/numeric/inner_product.hpp index 730b887d..3b516c05 100644 --- a/sprout/numeric/inner_product.hpp +++ b/sprout/numeric/inner_product.hpp @@ -99,7 +99,7 @@ namespace sprout { inner_product( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2, - void* + std::input_iterator_tag* ) { typedef sprout::tuples::tuple type; diff --git a/sprout/type_traits.hpp b/sprout/type_traits.hpp index 88d26a6b..a0bf0855 100644 --- a/sprout/type_traits.hpp +++ b/sprout/type_traits.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/sprout/type_traits/common_decay.hpp b/sprout/type_traits/common_decay.hpp new file mode 100644 index 00000000..4b22ade9 --- /dev/null +++ b/sprout/type_traits/common_decay.hpp @@ -0,0 +1,17 @@ +#ifndef SPROUT_TYPE_TRAITS_COMMON_DECAY_HPP +#define SPROUT_TYPE_TRAITS_COMMON_DECAY_HPP + +#include +#include + +namespace sprout { + // + // common_decay + // + template + struct common_decay + : public std::decay::type> + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_COMMON_DECAY_HPP