add iterator category check for algorithm incomplete implementation

This commit is contained in:
bolero-MURAKAMI 2013-01-31 23:25:18 +09:00
parent 1cfec16e52
commit 092910e2f7
29 changed files with 139 additions and 91 deletions

View file

@ -67,7 +67,7 @@ namespace sprout {
;
}
template<typename ForwardIterator, typename BinaryPredicate>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
adjacent_find_impl_1(
sprout::pair<ForwardIterator, ForwardIterator> const& current,
ForwardIterator last, BinaryPredicate pred, typename std::iterator_traits<ForwardIterator>::difference_type n
@ -88,7 +88,7 @@ namespace sprout {
;
}
template<typename ForwardIterator, typename BinaryPredicate>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
adjacent_find_impl(
sprout::pair<ForwardIterator, ForwardIterator> const& current,
ForwardIterator last, BinaryPredicate pred, typename std::iterator_traits<ForwardIterator>::difference_type n

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_CLAMP_RANGE_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/clamp_range_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/iterator/operation.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -42,6 +43,7 @@ namespace sprout {
Compare comp
)
{
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::clamp_range_copy_impl(first, last, result, low, high, comp, sprout::internal_begin_offset(result));
}
@ -73,6 +75,7 @@ namespace sprout {
typename std::iterator_traits<InputIterator>::value_type const& high
)
{
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::clamp_range_copy_impl(first, last, result, low, high, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/iterator/operation.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -33,6 +34,7 @@ namespace sprout {
template<typename InputIterator, typename Result>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
copy(InputIterator first, InputIterator last, Result const& result) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::copy_impl(first, last, result, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,13 @@
#define SPROUT_ALGORITHM_FIT_COPY_BACKWARD_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/copy_backward.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace fit {

View file

@ -8,6 +8,7 @@
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -32,6 +33,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
copy_if(InputIterator first, InputIterator last, Result const& result, Predicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::copy_if_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,15 @@
#define SPROUT_ALGORITHM_FIT_COPY_UNTIL_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/copy_until.hpp>
#include <sprout/algorithm/fixed/copy_while.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/algorithm/find_if.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -24,7 +26,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::copy_until(first, last, result, pred)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::distance(first, NS_SSCRISK_CEL_OR_SPROUT::find_if(first, last, pred)),
sprout::distance(first, sprout::find_if(first, last, pred)),
sprout::size(result)
)
);
@ -36,6 +38,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
copy_until(InputIterator first, InputIterator last, Result const& result, Predicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::copy_until_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,15 @@
#define SPROUT_ALGORITHM_FIT_COPY_WHILE_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/copy_while.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/algorithm/find_if_not.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -24,7 +26,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::copy_while(first, last, result, pred)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::distance(first, NS_SSCRISK_CEL_OR_SPROUT::find_if_not(first, last, pred)),
sprout::distance(first, sprout::find_if_not(first, last, pred)),
sprout::size(result)
)
);
@ -36,6 +38,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
copy_while(InputIterator first, InputIterator last, Result const& result, Predicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::copy_while_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,12 +2,12 @@
#define SPROUT_ALGORITHM_FIT_MAKE_PARTIAL_HEAP_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/make_partial_heap.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace fit {

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_MERGE_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/merge.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -43,6 +44,10 @@ namespace sprout {
Result const& result, Compare comp
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::merge_impl(first1, last1, first2, last2, result, comp, sprout::internal_begin_offset(result));
}
@ -77,6 +82,10 @@ namespace sprout {
Result const& result
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::merge_impl(first1, last1, first2, last2, result, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,12 +2,12 @@
#define SPROUT_ALGORITHM_FIT_NTH_ELEMENT_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/nth_element.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace fit {

View file

@ -2,12 +2,12 @@
#define SPROUT_ALGORITHM_FIT_PARTIAL_SORT_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/partial_sort.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace fit {

View file

@ -2,15 +2,16 @@
#define SPROUT_ALGORITHM_FIT_PARTITION_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/partition_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm/count_n_if.hpp>
#include <sprout/iterator/operation.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -28,8 +29,7 @@ namespace sprout {
offset + sprout::detail::count_n_if(
first,
NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::distance(first, last),
sprout::size(result)
sprout::distance(first, last), sprout::size(result)
),
pred
)
@ -42,6 +42,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
partition_copy(InputIterator first, InputIterator last, Result const& result, Predicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::partition_copy_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_REMOVE_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/remove_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -36,6 +37,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename T>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
remove_copy(InputIterator first, InputIterator last, Result const& result, T const& value) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::remove_copy_impl(first, last, result, value, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_REMOVE_COPY_IF_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/remove_copy_if.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -36,6 +37,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
remove_copy_if(InputIterator first, InputIterator last, Result const& result, Predicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::remove_copy_if_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_REPLACE_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/replace_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -33,7 +34,10 @@ namespace sprout {
template<typename InputIterator, typename Result, typename T>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
replace_copy(InputIterator first, InputIterator last, Result const& result, T const& old_value, T const& new_value) {
return sprout::fit::detail::replace_copy_impl(first, last, result, old_value, new_value, sprout::internal_begin_offset(result));
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::replace_copy_impl(
first, last, result, old_value, new_value, sprout::internal_begin_offset(result)
);
}
} // namespace fit
} // namespace sprout

View file

@ -2,13 +2,14 @@
#define SPROUT_ALGORITHM_FIT_REPLACE_COPY_IF_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/replace_copy_if.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -33,6 +34,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename T, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
replace_copy_if(InputIterator first, InputIterator last, Result const& result, Predicate pred, T const& new_value) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::replace_copy_if_impl(first, last, result, pred, new_value, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,13 +2,13 @@
#define SPROUT_ALGORITHM_FIT_REVERSE_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/reverse_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace fit {

View file

@ -2,13 +2,13 @@
#define SPROUT_ALGORITHM_FIT_ROTATE_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/rotate_copy.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace fit {

View file

@ -2,14 +2,15 @@
#define SPROUT_ALGORITHM_FIT_SET_DIFFERENCE_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/set_difference.hpp>
#include <sprout/algorithm/fixed/set_union.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -46,6 +47,10 @@ namespace sprout {
Result const& result, Compare comp
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_difference_impl(first1, last1, first2, last2, result, comp, sprout::internal_begin_offset(result));
}
@ -82,6 +87,10 @@ namespace sprout {
Result const& result
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_difference_impl(first1, last1, first2, last2, result, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -4,11 +4,12 @@
#include <sprout/config.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/set_intersection.hpp>
#include <sprout/algorithm/fixed/set_union.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -43,6 +44,10 @@ namespace sprout {
Result const& result, Compare comp
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_intersection_impl(first1, last1, first2, last2, result, comp, sprout::internal_begin_offset(result));
}
@ -77,6 +82,10 @@ namespace sprout {
Result const& result
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_intersection_impl(first1, last1, first2, last2, result, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,14 +2,15 @@
#define SPROUT_ALGORITHM_FIT_SET_SYMMETRIC_DIFFERENCE_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/set_symmetric_difference.hpp>
#include <sprout/algorithm/fixed/set_union.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -27,8 +28,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result, comp)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::distance(first1, last1)
+ sprout::distance(first2, last2)
sprout::distance(first1, last1) + sprout::distance(first2, last2)
- 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
,
sprout::size(result)
@ -47,6 +47,10 @@ namespace sprout {
Result const& result, Compare comp
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_symmetric_difference_impl(first1, last1, first2, last2, result, comp, sprout::internal_begin_offset(result));
}
@ -84,6 +88,10 @@ namespace sprout {
Result const& result
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_symmetric_difference_impl(first1, last1, first2, last2, result, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,6 +2,7 @@
#define SPROUT_ALGORITHM_FIT_SET_UNION_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/set_union.hpp>
@ -9,7 +10,7 @@
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm/set_overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -27,8 +28,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::set_union(first1, last1, first2, last2, result, comp)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::distance(first1, last1)
+ sprout::distance(first2, last2)
sprout::distance(first1, last1) + sprout::distance(first2, last2)
- sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
,
sprout::size(result)
@ -47,6 +47,10 @@ namespace sprout {
Result const& result, Compare comp
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_union_impl(first1, last1, first2, last2, result, comp, sprout::internal_begin_offset(result));
}
@ -64,8 +68,7 @@ namespace sprout {
sprout::get_internal(sprout::fixed::set_union(first1, last1, first2, last2, result)),
offset,
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
sprout::distance(first1, last1)
+ sprout::distance(first2, last2)
sprout::distance(first1, last1) + sprout::distance(first2, last2)
- sprout::detail::set_overlap_count(first1, last1, first2, last2)
,
sprout::size(result)
@ -84,6 +87,10 @@ namespace sprout {
Result const& result
)
{
static_assert(
sprout::is_forward_iterator<InputIterator1>::value && sprout::is_forward_iterator<InputIterator2>::value,
"Sorry, not implemented."
);
return sprout::fit::detail::set_union_impl(first1, last1, first2, last2, result, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -8,6 +8,7 @@
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -32,6 +33,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename Predicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
stable_partition_copy(InputIterator first, InputIterator last, Result const& result, Predicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::stable_partition_copy_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,21 +2,22 @@
#define SPROUT_ALGORITHM_FIT_TRANSFORM_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/transform.hpp>
#include <sprout/algorithm/fit/result_of.hpp>
#include <sprout/sub_array.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename UnaryOperation>
template<typename InputIterator, typename Result, typename UnaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
transform_impl(
Iterator first, Iterator last, Result const& result, UnaryOperation op,
InputIterator first, InputIterator last, Result const& result, UnaryOperation op,
typename sprout::container_traits<Result>::difference_type offset
)
{
@ -30,17 +31,18 @@ namespace sprout {
//
// transform
//
template<typename Iterator, typename Result, typename UnaryOperation>
template<typename InputIterator, typename Result, typename UnaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
transform(Iterator first, Iterator last, Result const& result, UnaryOperation op) {
transform(InputIterator first, InputIterator last, Result const& result, UnaryOperation op) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::transform_impl(first, last, result, op, sprout::internal_begin_offset(result));
}
namespace detail {
template<typename Iterator1, typename Iterator2, typename Result, typename BinaryOperation>
template<typename InputIterator1, typename InputIterator2, typename Result, typename BinaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
transform_impl(
Iterator1 first1, Iterator1 last1, Iterator2 first2, Result const& result, BinaryOperation op,
InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Result const& result, BinaryOperation op,
typename sprout::container_traits<Result>::difference_type offset
)
{
@ -54,9 +56,10 @@ namespace sprout {
//
// transform
//
template<typename Iterator1, typename Iterator2, typename Result, typename BinaryOperation>
template<typename InputIterator1, typename InputIterator2, typename Result, typename BinaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
transform(Iterator1 first1, Iterator1 last1, Iterator2 first2, Result const& result, BinaryOperation op) {
transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Result const& result, BinaryOperation op) {
static_assert(sprout::is_forward_iterator<InputIterator1>::value, "Sorry, not implemented.");
return sprout::fit::detail::transform_impl(first1, last1, first2, result, op, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -2,6 +2,7 @@
#define SPROUT_ALGORITHM_FIT_UNIQUE_COPY_HPP
#include <sprout/config.hpp>
#include <sprout/iterator/distance.hpp>
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/algorithm/fixed/unique_copy.hpp>
@ -9,7 +10,7 @@
#include <sprout/sub_array.hpp>
#include <sprout/detail/algorithm/overlap_count.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fit {
@ -37,6 +38,7 @@ namespace sprout {
template<typename InputIterator, typename Result>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
unique_copy(InputIterator first, InputIterator last, Result const& result) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::unique_copy_impl(first, last, result, sprout::internal_begin_offset(result));
}
@ -64,6 +66,7 @@ namespace sprout {
template<typename InputIterator, typename Result, typename BinaryPredicate>
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
unique_copy(InputIterator first, InputIterator last, Result const& result, BinaryPredicate pred) {
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fit::detail::unique_copy_impl(first, last, result, pred, sprout::internal_begin_offset(result));
}
} // namespace fit

View file

@ -12,6 +12,7 @@
#include <sprout/pit.hpp>
#include <sprout/math/comparison.hpp>
#include <sprout/detail/container_complate.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fixed {
@ -74,23 +75,14 @@ namespace sprout {
return sprout::fixed::detail::copy_n(first, n, result, category());
}
template<typename ForwardIterator, typename Size, typename Result>
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
copy_n_dyn(
ForwardIterator first, Size n, Result const& result,
std::forward_iterator_tag*
)
{
return sprout::fixed::copy(first, sprout::next(first, n), result);
}
template<typename InputIterator, typename Size, typename Result>
inline SPROUT_CONSTEXPR typename std::enable_if<
!sprout::is_fixed_container<Result>::value,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type
copy_n(InputIterator first, Size n, Result const& result) {
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
return sprout::fixed::detail::copy_n_dyn(first, n, result, category());
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::fixed::copy(first, sprout::next(first, n), result);
}
} // namespace detail
//

View file

@ -1,7 +1,6 @@
#ifndef SPROUT_ALGORITHM_FIXED_UNIQUE_COPY_HPP
#define SPROUT_ALGORITHM_FIXED_UNIQUE_COPY_HPP
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/container/traits.hpp>
@ -11,6 +10,7 @@
#include <sprout/algorithm/fixed/result_of.hpp>
#include <sprout/pit.hpp>
#include <sprout/detail/container_complate.hpp>
#include <sprout/iterator/type_traits/is_iterator.hpp>
namespace sprout {
namespace fixed {
@ -63,27 +63,18 @@ namespace sprout {
;
}
template<typename InputIterator, typename Result>
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
unique_copy_dyn(
InputIterator first, InputIterator last, Result const& result,
std::forward_iterator_tag*
)
{
return sprout::remake<Result>(
result, sprout::size(result),
sprout::make_unique_iterator(first, last),
sprout::make_unique_iterator(last, last)
);
}
template<typename InputIterator, typename Result>
inline SPROUT_CONSTEXPR typename std::enable_if<
!sprout::is_fixed_container<Result>::value,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type
unique_copy(InputIterator first, InputIterator last, Result const& result) {
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
return sprout::fixed::detail::unique_copy_dyn(first, last, result, category());
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::remake<Result>(
result, sprout::size(result),
sprout::make_unique_iterator(first, last),
sprout::make_unique_iterator(last, last)
);
}
} // namespace detail
//
@ -150,27 +141,18 @@ namespace sprout {
;
}
template<typename InputIterator, typename Result, typename BinaryPredicate>
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
unique_copy_dyn(
InputIterator first, InputIterator last, Result const& result, BinaryPredicate pred,
std::forward_iterator_tag*
)
{
return sprout::remake<Result>(
result, sprout::size(result),
sprout::make_unique_iterator(pred, first, last),
sprout::make_unique_iterator(pred, last, last)
);
}
template<typename InputIterator, typename Result, typename BinaryPredicate>
inline SPROUT_CONSTEXPR typename std::enable_if<
!sprout::is_fixed_container<Result>::value,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type
unique_copy(InputIterator first, InputIterator last, Result const& result, BinaryPredicate pred) {
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
return sprout::fixed::detail::unique_copy_dyn(first, last, result, pred, category());
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
return sprout::remake<Result>(
result, sprout::size(result),
sprout::make_unique_iterator(pred, first, last),
sprout::make_unique_iterator(pred, last, last)
);
}
} // namespace detail
//

View file

@ -52,7 +52,7 @@ namespace sprout {
}
template<typename ForwardIterator, typename Compare>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
is_sorted_until_impl_1(
sprout::pair<ForwardIterator, ForwardIterator> const& current,
ForwardIterator last, Compare comp, typename std::iterator_traits<ForwardIterator>::difference_type n
@ -73,7 +73,7 @@ namespace sprout {
;
}
template<typename ForwardIterator, typename Compare>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
inline SPROUT_CONSTEXPR sprout::pair<ForwardIterator, ForwardIterator>
is_sorted_until_impl(
sprout::pair<ForwardIterator, ForwardIterator> const& current,
ForwardIterator last, Compare comp, typename std::iterator_traits<ForwardIterator>::difference_type n

View file

@ -24,7 +24,7 @@ namespace sprout {
: sprout::detail::strchr_impl_1(
sprout::detail::strchr_impl_1(
current,
value, n / 2
value, n / 2
),
value, n - n / 2
)