mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +00:00
support STL container: set operation algorithms
This commit is contained in:
parent
ee8602f6a3
commit
271f348972
17 changed files with 1488 additions and 76 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/set_intersection_iterator.hpp>
|
||||
#include <sprout/functional/less.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
|
@ -59,16 +60,8 @@ namespace sprout {
|
|||
sprout::next(first1), last1, sprout::next(first2), last2, result, comp,
|
||||
size, args..., *first1
|
||||
)
|
||||
: sprout::fixed::detail::set_intersection_impl(
|
||||
sprout::next(first1), last1, first2, last2, result, comp,
|
||||
size, args...
|
||||
)
|
||||
: first2 != last2
|
||||
? sprout::fixed::detail::set_intersection_impl(
|
||||
first1, last1, sprout::next(first2), last2, result, comp,
|
||||
size, args...
|
||||
)
|
||||
: sprout::detail::container_complate(result, args...)
|
||||
: sprout::detail::container_complate(result, args...)
|
||||
: sprout::detail::container_complate(result, args...)
|
||||
;
|
||||
}
|
||||
|
@ -91,6 +84,24 @@ namespace sprout {
|
|||
sprout::size(result)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
set_intersection(
|
||||
InputIterator1 first1, InputIterator1 last1,
|
||||
InputIterator2 first2, InputIterator2 last2,
|
||||
Result const& result, Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(
|
||||
result, sprout::size(result),
|
||||
sprout::make_set_intersection_iterator(first1, last1, first2, last2, comp),
|
||||
sprout::make_set_intersection_iterator(last1, last1, last2, last2, comp)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_intersection
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue