mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2024-11-12 21:09:01 +00:00
remove slipped file
This commit is contained in:
parent
ff36d79afc
commit
2232778731
6 changed files with 22 additions and 228 deletions
|
@ -1,209 +0,0 @@
|
||||||
/*=============================================================================
|
|
||||||
Copyright (c) 2011-2013 Bolero MURAKAMI
|
|
||||||
https://github.com/bolero-MURAKAMI/Sprout
|
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
=============================================================================*/
|
|
||||||
#ifndef SPROUT_ITERATOR_SET_INTERSECTION_ITERATOR_HPP
|
|
||||||
#define SPROUT_ITERATOR_SET_INTERSECTION_ITERATOR_HPP
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
#include <utility>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <sprout/config.hpp>
|
|
||||||
#include <sprout/iterator/next.hpp>
|
|
||||||
#include <sprout/iterator/type_traits/common.hpp>
|
|
||||||
#include <sprout/functional/less.hpp>
|
|
||||||
#include <sprout/utility/swap.hpp>
|
|
||||||
#include <sprout/utility/pair/pair.hpp>
|
|
||||||
#include <sprout/algorithm/find_intersection.hpp>
|
|
||||||
#include <sprout/algorithm/next_intersection.hpp>
|
|
||||||
|
|
||||||
namespace sprout {
|
|
||||||
//
|
|
||||||
// set_intersection_iterator
|
|
||||||
//
|
|
||||||
template<
|
|
||||||
typename LIterator, typename RIterator,
|
|
||||||
typename Compare = sprout::less<>
|
|
||||||
>
|
|
||||||
class set_intersection_iterator
|
|
||||||
: public std::iterator<
|
|
||||||
typename sprout::min_iterator_category<
|
|
||||||
typename sprout::common_iterator_category<LIterator, RIterator>::type,
|
|
||||||
std::forward_iterator_tag
|
|
||||||
>::type,
|
|
||||||
typename sprout::common_iterator_value_type<LIterator, RIterator>::type,
|
|
||||||
typename sprout::common_iterator_difference_type<LIterator, RIterator>::type,
|
|
||||||
typename sprout::common_iterator_pointer<LIterator, RIterator>::type,
|
|
||||||
typename sprout::common_iterator_reference<LIterator, RIterator>::type
|
|
||||||
>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef LIterator iterator_type;
|
|
||||||
typedef RIterator iterator2_type;
|
|
||||||
typedef Compare compare_type;
|
|
||||||
typedef typename sprout::min_iterator_category<
|
|
||||||
typename sprout::common_iterator_category<LIterator, RIterator>::type,
|
|
||||||
std::forward_iterator_tag
|
|
||||||
>::type iterator_category;
|
|
||||||
typedef typename sprout::common_iterator_value_type<LIterator, RIterator>::type value_type;
|
|
||||||
typedef typename sprout::common_iterator_difference_type<LIterator, RIterator>::type difference_type;
|
|
||||||
typedef typename sprout::common_iterator_pointer<LIterator, RIterator>::type pointer;
|
|
||||||
typedef typename sprout::common_iterator_reference<LIterator, RIterator>::type reference;
|
|
||||||
protected:
|
|
||||||
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
|
|
||||||
protected:
|
|
||||||
pair_type current;
|
|
||||||
iterator_type lst1;
|
|
||||||
iterator2_type lst2;
|
|
||||||
Compare comp;
|
|
||||||
private:
|
|
||||||
SPROUT_CONSTEXPR set_intersection_iterator(set_intersection_iterator const& other, pair_type const& next)
|
|
||||||
: current(next)
|
|
||||||
, lst1(other.lst1), lst2(other.lst2)
|
|
||||||
, comp(other.comp)
|
|
||||||
{}
|
|
||||||
public:
|
|
||||||
set_intersection_iterator()
|
|
||||||
: current(), lst1(), lst2(), comp()
|
|
||||||
{}
|
|
||||||
set_intersection_iterator(set_intersection_iterator const&) = default;
|
|
||||||
SPROUT_CONSTEXPR set_intersection_iterator(
|
|
||||||
iterator_type it1, iterator_type lst1,
|
|
||||||
iterator2_type it2, iterator2_type lst2,
|
|
||||||
Compare comp = Compare()
|
|
||||||
)
|
|
||||||
: current(sprout::find_intersection(it1, lst1, it2, lst2, comp))
|
|
||||||
, lst1(lst1), lst2(lst2)
|
|
||||||
, comp(comp)
|
|
||||||
{}
|
|
||||||
template<typename U, typename V, typename W>
|
|
||||||
SPROUT_CONSTEXPR set_intersection_iterator(set_intersection_iterator<U, V, W> const& it)
|
|
||||||
: current(it.base(), it.base2())
|
|
||||||
, lst1(it.last1()), lst2(it.last2())
|
|
||||||
, comp(it.compare())
|
|
||||||
{}
|
|
||||||
template<typename U, typename V, typename W>
|
|
||||||
set_intersection_iterator& operator=(set_intersection_iterator<U, V, W> const& it) {
|
|
||||||
set_intersection_iterator temp(it);
|
|
||||||
temp.swap(*this);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR iterator_type base() const {
|
|
||||||
return current.first;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR iterator_type last1() const {
|
|
||||||
return lst1;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
|
||||||
return current.second;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR iterator2_type last2() const {
|
|
||||||
return lst2;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR Compare compare() const {
|
|
||||||
return comp;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR bool is_in_left() const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR reference operator*() const {
|
|
||||||
return *current.first;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR pointer operator->() const {
|
|
||||||
return &*(*this);
|
|
||||||
}
|
|
||||||
set_intersection_iterator& operator++() {
|
|
||||||
current = sprout::next_intersection(current.first, lst1, current.second, lst2, comp);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
set_intersection_iterator operator++(int) {
|
|
||||||
set_intersection_iterator result(*this);
|
|
||||||
current = sprout::next_intersection(current.first, lst1, current.second, lst2, comp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR set_intersection_iterator next() const {
|
|
||||||
return set_intersection_iterator(
|
|
||||||
*this,
|
|
||||||
sprout::next_intersection(current.first, lst1, current.second, lst2, comp)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
void swap(set_intersection_iterator& other)
|
|
||||||
SPROUT_NOEXCEPT_EXPR(
|
|
||||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
|
||||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst1, other.lst1))
|
|
||||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
|
|
||||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sprout::swap(current, other.current);
|
|
||||||
sprout::swap(lst1, other.lst1);
|
|
||||||
sprout::swap(lst2, other.lst2);
|
|
||||||
sprout::swap(comp, other.comp);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<
|
|
||||||
typename LIterator1, typename RIterator1, typename Compare1,
|
|
||||||
typename LIterator2, typename RIterator2, typename Compare2
|
|
||||||
>
|
|
||||||
inline SPROUT_CONSTEXPR bool operator==(
|
|
||||||
sprout::set_intersection_iterator<LIterator1, RIterator1, Compare1> const& lhs,
|
|
||||||
sprout::set_intersection_iterator<LIterator2, RIterator2, Compare2> const& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return lhs.base() == rhs.base() && lhs.base2() == rhs.base2();
|
|
||||||
}
|
|
||||||
template<
|
|
||||||
typename LIterator1, typename RIterator1, typename Compare1,
|
|
||||||
typename LIterator2, typename RIterator2, typename Compare2
|
|
||||||
>
|
|
||||||
inline SPROUT_CONSTEXPR bool operator!=(
|
|
||||||
sprout::set_intersection_iterator<LIterator1, RIterator1, Compare1> const& lhs,
|
|
||||||
sprout::set_intersection_iterator<LIterator2, RIterator2, Compare2> const& rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return !(lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// make_set_intersection_iterator
|
|
||||||
//
|
|
||||||
template<typename LIterator, typename RIterator, typename Compare>
|
|
||||||
inline SPROUT_CONSTEXPR sprout::set_intersection_iterator<LIterator, RIterator, Compare>
|
|
||||||
make_set_intersection_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2, Compare comp) {
|
|
||||||
return sprout::set_intersection_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
|
|
||||||
}
|
|
||||||
template<typename LIterator, typename RIterator>
|
|
||||||
inline SPROUT_CONSTEXPR sprout::set_intersection_iterator<LIterator, RIterator>
|
|
||||||
make_set_intersection_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2) {
|
|
||||||
return sprout::set_intersection_iterator<LIterator, RIterator>(it1, lst1, it2, lst2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// swap
|
|
||||||
//
|
|
||||||
template<typename LIterator, typename RIterator, typename Compare>
|
|
||||||
inline void
|
|
||||||
swap(
|
|
||||||
sprout::set_intersection_iterator<LIterator, RIterator, Compare>& lhs,
|
|
||||||
sprout::set_intersection_iterator<LIterator, RIterator, Compare>& rhs
|
|
||||||
)
|
|
||||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
|
||||||
{
|
|
||||||
lhs.swap(rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// iterator_next
|
|
||||||
//
|
|
||||||
template<typename LIterator, typename RIterator, typename Compare>
|
|
||||||
inline SPROUT_CONSTEXPR sprout::set_intersection_iterator<LIterator, RIterator, Compare>
|
|
||||||
iterator_next(sprout::set_intersection_iterator<LIterator, RIterator, Compare> const& it) {
|
|
||||||
return it.next();
|
|
||||||
}
|
|
||||||
} // namespace sprout
|
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_ITERATOR_SET_INTERSECTION_ITERATOR_HPP
|
|
|
@ -152,9 +152,12 @@ namespace sprout {
|
||||||
SPROUT_CONSTEXPR reference_wrapper(T& t) SPROUT_NOEXCEPT
|
SPROUT_CONSTEXPR reference_wrapper(T& t) SPROUT_NOEXCEPT
|
||||||
: t_(&t)
|
: t_(&t)
|
||||||
{}
|
{}
|
||||||
reference_wrapper(reference_wrapper<T> const&) SPROUT_NOEXCEPT = default;
|
reference_wrapper(reference_wrapper const&) = default;
|
||||||
// assignment
|
// assignment
|
||||||
reference_wrapper& operator=(reference_wrapper<T> const&) SPROUT_NOEXCEPT = default;
|
SPROUT_CXX14_CONSTEXPR reference_wrapper& operator=(reference_wrapper const& rhs) {
|
||||||
|
t_ = rhs.t_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
// access
|
// access
|
||||||
SPROUT_CONSTEXPR operator T& () const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR operator T& () const SPROUT_NOEXCEPT {
|
||||||
return *t_;
|
return *t_;
|
||||||
|
|
|
@ -44,8 +44,7 @@ namespace sprout {
|
||||||
Compare comp;
|
Compare comp;
|
||||||
value_type low;
|
value_type low;
|
||||||
value_type up;
|
value_type up;
|
||||||
private:
|
public:
|
||||||
public:
|
|
||||||
clamp_iterator() = default;
|
clamp_iterator() = default;
|
||||||
clamp_iterator(clamp_iterator const&) = default;
|
clamp_iterator(clamp_iterator const&) = default;
|
||||||
SPROUT_CONSTEXPR clamp_iterator(iterator_type it, value_type const& low, value_type const& up, Compare comp = Compare())
|
SPROUT_CONSTEXPR clamp_iterator(iterator_type it, value_type const& low, value_type const& up, Compare comp = Compare())
|
||||||
|
@ -56,7 +55,7 @@ namespace sprout {
|
||||||
: current(it.current), comp(it.comp), low(it.low), up(it.up)
|
: current(it.current), comp(it.comp), low(it.low), up(it.up)
|
||||||
{}
|
{}
|
||||||
template<typename U, typename V>
|
template<typename U, typename V>
|
||||||
clamp_iterator& operator=(clamp_iterator<U, V> const& it) {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator& operator=(clamp_iterator<U, V> const& it) {
|
||||||
clamp_iterator temp(it);
|
clamp_iterator temp(it);
|
||||||
temp.swap(*this);
|
temp.swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -80,20 +79,20 @@ namespace sprout {
|
||||||
return &sprout::clamp(*current, low, up, comp);
|
return &sprout::clamp(*current, low, up, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
clamp_iterator& operator++() {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator& operator++() {
|
||||||
++current;
|
++current;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
clamp_iterator operator++(int) {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator operator++(int) {
|
||||||
clamp_iterator result(*this);
|
clamp_iterator result(*this);
|
||||||
++current;
|
++current;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
clamp_iterator& operator--() {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator& operator--() {
|
||||||
--current;
|
--current;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
clamp_iterator operator--(int) {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator operator--(int) {
|
||||||
clamp_iterator temp(*this);
|
clamp_iterator temp(*this);
|
||||||
--current;
|
--current;
|
||||||
return temp;
|
return temp;
|
||||||
|
@ -104,12 +103,12 @@ namespace sprout {
|
||||||
SPROUT_CONSTEXPR clamp_iterator operator-(difference_type n) const {
|
SPROUT_CONSTEXPR clamp_iterator operator-(difference_type n) const {
|
||||||
return clamp_iterator(sprout::prev(current, n), low, up, comp);
|
return clamp_iterator(sprout::prev(current, n), low, up, comp);
|
||||||
}
|
}
|
||||||
clamp_iterator& operator+=(difference_type n) {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator& operator+=(difference_type n) {
|
||||||
clamp_iterator temp(sprout::next(current, n), low, up, comp);
|
clamp_iterator temp(sprout::next(current, n), low, up, comp);
|
||||||
temp.swap(*this);
|
temp.swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
clamp_iterator& operator-=(difference_type n) {
|
SPROUT_CXX14_CONSTEXPR clamp_iterator& operator-=(difference_type n) {
|
||||||
clamp_iterator temp(sprout::prev(current, n), low, up, comp);
|
clamp_iterator temp(sprout::prev(current, n), low, up, comp);
|
||||||
temp.swap(*this);
|
temp.swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -123,7 +122,7 @@ namespace sprout {
|
||||||
SPROUT_CONSTEXPR clamp_iterator prev() const {
|
SPROUT_CONSTEXPR clamp_iterator prev() const {
|
||||||
return clamp_iterator(sprout::prev(current), low, up, comp);
|
return clamp_iterator(sprout::prev(current), low, up, comp);
|
||||||
}
|
}
|
||||||
void swap(clamp_iterator& other)
|
SPROUT_CXX14_CONSTEXPR void swap(clamp_iterator& other)
|
||||||
SPROUT_NOEXCEPT_EXPR(
|
SPROUT_NOEXCEPT_EXPR(
|
||||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
||||||
|
@ -215,7 +214,7 @@ namespace sprout {
|
||||||
// swap
|
// swap
|
||||||
//
|
//
|
||||||
template<typename Iterator, typename Compare>
|
template<typename Iterator, typename Compare>
|
||||||
inline void
|
inline SPROUT_CXX14_CONSTEXPR void
|
||||||
swap(sprout::clamp_iterator<Iterator, Compare>& lhs, sprout::clamp_iterator<Iterator, Compare>& rhs)
|
swap(sprout::clamp_iterator<Iterator, Compare>& lhs, sprout::clamp_iterator<Iterator, Compare>& rhs)
|
||||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,7 +178,7 @@ namespace sprout {
|
||||||
, is_sep(it.is_sep)
|
, is_sep(it.is_sep)
|
||||||
{}
|
{}
|
||||||
template<typename U, bool V>
|
template<typename U, bool V>
|
||||||
size_enum_iterator& operator=(size_enum_iterator<U, V> const& it) {
|
SPROUT_CXX14_CONSTEXPR size_enum_iterator& operator=(size_enum_iterator<U, V> const& it) {
|
||||||
size_enum_iterator temp(it);
|
size_enum_iterator temp(it);
|
||||||
temp.swap(*this);
|
temp.swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace sprout {
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename Iterator2>
|
template<typename Iterator2>
|
||||||
void swap(range_container<Iterator2>& other)
|
SPROUT_CXX14_CONSTEXPR void swap(range_container<Iterator2>& other)
|
||||||
SPROUT_NOEXCEPT_EXPR(
|
SPROUT_NOEXCEPT_EXPR(
|
||||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(other.first_, first_))
|
SPROUT_NOEXCEPT_EXPR(sprout::swap(other.first_, first_))
|
||||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(other.last_, last_))
|
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(other.last_, last_))
|
||||||
|
@ -88,13 +88,13 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
// others:
|
// others:
|
||||||
template<typename Iterator2>
|
template<typename Iterator2>
|
||||||
range_container<Iterator>& operator=(range_container<Iterator2> const& rhs) {
|
SPROUT_CXX14_CONSTEXPR range_container<Iterator>& operator=(range_container<Iterator2> const& rhs) {
|
||||||
first_ = rhs.first_;
|
first_ = rhs.first_;
|
||||||
last_ = rhs.last_;
|
last_ = rhs.last_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename Iterator2>
|
template<typename Iterator2>
|
||||||
range_container<Iterator>& operator=(range_container<Iterator2>&& rhs) {
|
SPROUT_CXX14_CONSTEXPR range_container<Iterator>& operator=(range_container<Iterator2>&& rhs) {
|
||||||
first_ = std::move(rhs.first_);
|
first_ = std::move(rhs.first_);
|
||||||
last_ = std::move(rhs.last_);
|
last_ = std::move(rhs.last_);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -105,7 +105,8 @@ namespace sprout {
|
||||||
// swap
|
// swap
|
||||||
//
|
//
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
inline void swap(sprout::range::range_container<Iterator>& lhs, sprout::range::range_container<Iterator>& rhs) {
|
inline SPROUT_CXX14_CONSTEXPR void
|
||||||
|
swap(sprout::range::range_container<Iterator>& lhs, sprout::range::range_container<Iterator>& rhs) {
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace sprout {
|
||||||
struct ignore_t {
|
struct ignore_t {
|
||||||
public:
|
public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ignore_t const& operator=(T const&) const {
|
SPROUT_CXX14_CONSTEXPR ignore_t const& operator=(T const&) const {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue