mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix iterator parameter
This commit is contained in:
parent
6e8b5ea395
commit
802f2fbaed
111 changed files with 607 additions and 633 deletions
|
@ -51,41 +51,41 @@ namespace sprout {
|
|||
typedef typename sprout::common_iterator_reference<LIterator, RIterator>::type reference;
|
||||
private:
|
||||
static SPROUT_CONSTEXPR bool check_in_left(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return it1 != lst_1 ? (it2 != lst_2 ? !comp(*it2, *it1) : true)
|
||||
: !(it2 != lst_2)
|
||||
return it1 != las1 ? (it2 != las2 ? !comp(*it2, *it1) : true)
|
||||
: !(it2 != las2)
|
||||
;
|
||||
}
|
||||
protected:
|
||||
iterator_type current1;
|
||||
iterator_type lst_1;
|
||||
iterator_type las1;
|
||||
iterator2_type current2;
|
||||
iterator2_type lst_2;
|
||||
iterator2_type las2;
|
||||
Compare comp;
|
||||
bool in_left;
|
||||
public:
|
||||
SPROUT_CONSTEXPR merge_iterator()
|
||||
: current1(), lst_1(), current2(), lst_2(), comp(), in_left(true)
|
||||
: current1(), las1(), current2(), las2(), comp(), in_left(true)
|
||||
{}
|
||||
merge_iterator(merge_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR merge_iterator(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp = Compare()
|
||||
)
|
||||
: current1(it1), lst_1(lst_1)
|
||||
, current2(it2), lst_2(lst_2)
|
||||
: current1(it1), las1(las1)
|
||||
, current2(it2), las2(las2)
|
||||
, comp(comp)
|
||||
, in_left(check_in_left(it1, lst_1, it2, lst_2, comp))
|
||||
, in_left(check_in_left(it1, las1, it2, las2, comp))
|
||||
{}
|
||||
template<typename U, typename V, typename W>
|
||||
SPROUT_CONSTEXPR merge_iterator(merge_iterator<U, V, W> const& it)
|
||||
: current1(it.base()), lst_1(it.last1())
|
||||
, current2(it.base2()), lst_2(it.last2())
|
||||
: current1(it.base()), las1(it.last1())
|
||||
, current2(it.base2()), las2(it.last2())
|
||||
, comp(it.compare())
|
||||
, in_left(it.is_in_left())
|
||||
{}
|
||||
|
@ -99,13 +99,13 @@ namespace sprout {
|
|||
return current1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type last1() const {
|
||||
return lst_1;
|
||||
return las1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
||||
return current2;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type last2() const {
|
||||
return lst_2;
|
||||
return las2;
|
||||
}
|
||||
SPROUT_CONSTEXPR Compare compare() const {
|
||||
return comp;
|
||||
|
@ -120,8 +120,8 @@ namespace sprout {
|
|||
return &*(*this);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR merge_iterator& operator++() {
|
||||
if (current1 != lst_1) {
|
||||
if (current2 != lst_2) {
|
||||
if (current1 != las1) {
|
||||
if (current2 != las2) {
|
||||
if (comp(*current2, *current1)) {
|
||||
++current2;
|
||||
} else {
|
||||
|
@ -130,16 +130,16 @@ namespace sprout {
|
|||
} else {
|
||||
++current1;
|
||||
}
|
||||
} else if (current2 != lst_2) {
|
||||
} else if (current2 != las2) {
|
||||
++current2;
|
||||
}
|
||||
in_left = check_in_left(current1, lst_1, current2, lst_2, comp);
|
||||
in_left = check_in_left(current1, las1, current2, las2, comp);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR merge_iterator operator++(int) {
|
||||
merge_iterator result(*this);
|
||||
if (current1 != lst_1) {
|
||||
if (current2 != lst_2) {
|
||||
if (current1 != las1) {
|
||||
if (current2 != las2) {
|
||||
if (comp(*current2, *current1)) {
|
||||
++current2;
|
||||
} else {
|
||||
|
@ -148,38 +148,38 @@ namespace sprout {
|
|||
} else {
|
||||
++current1;
|
||||
}
|
||||
} else if (current2 != lst_2) {
|
||||
} else if (current2 != las2) {
|
||||
++current2;
|
||||
}
|
||||
in_left = check_in_left(current1, lst_1, current2, lst_2, comp);
|
||||
in_left = check_in_left(current1, las1, current2, las2, comp);
|
||||
return result;
|
||||
}
|
||||
SPROUT_CONSTEXPR merge_iterator next() const {
|
||||
return current1 != lst_1
|
||||
? current2 != lst_2
|
||||
return current1 != las1
|
||||
? current2 != las2
|
||||
? comp(*current2, *current1)
|
||||
? merge_iterator(current1, lst_1, sprout::next(current2), lst_2, comp)
|
||||
: merge_iterator(sprout::next(current1), lst_1, current2, lst_2, comp)
|
||||
: merge_iterator(sprout::next(current1), lst_1, current2, lst_2, comp)
|
||||
: current2 != lst_2
|
||||
? merge_iterator(current1, lst_1, sprout::next(current2), lst_2, comp)
|
||||
? merge_iterator(current1, las1, sprout::next(current2), las2, comp)
|
||||
: merge_iterator(sprout::next(current1), las1, current2, las2, comp)
|
||||
: merge_iterator(sprout::next(current1), las1, current2, las2, comp)
|
||||
: current2 != las2
|
||||
? merge_iterator(current1, las1, sprout::next(current2), las2, comp)
|
||||
: *this
|
||||
;
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR void swap(merge_iterator& other)
|
||||
SPROUT_NOEXCEPT_IF(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current1, other.current1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_1, other.lst_1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las1, other.las1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(current2, other.current2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_2, other.lst_2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las2, other.las2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(in_left, other.in_left))
|
||||
)
|
||||
{
|
||||
sprout::swap(current1, other.current1);
|
||||
sprout::swap(lst_1, other.lst_1);
|
||||
sprout::swap(las1, other.las1);
|
||||
sprout::swap(current2, other.current2);
|
||||
sprout::swap(lst_2, other.lst_2);
|
||||
sprout::swap(las2, other.las2);
|
||||
sprout::swap(comp, other.comp);
|
||||
sprout::swap(in_left, other.in_left);
|
||||
}
|
||||
|
@ -213,13 +213,13 @@ namespace sprout {
|
|||
//
|
||||
template<typename LIterator, typename RIterator, typename Compare>
|
||||
inline SPROUT_CONSTEXPR sprout::merge_iterator<LIterator, RIterator, Compare>
|
||||
make_merge_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2, Compare comp) {
|
||||
return sprout::merge_iterator<LIterator, RIterator, Compare>(it1, lst_1, it2, lst_2, comp);
|
||||
make_merge_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2, Compare comp) {
|
||||
return sprout::merge_iterator<LIterator, RIterator, Compare>(it1, las1, it2, las2, comp);
|
||||
}
|
||||
template<typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::merge_iterator<LIterator, RIterator>
|
||||
make_merge_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2) {
|
||||
return sprout::merge_iterator<LIterator, RIterator>(it1, lst_1, it2, lst_2);
|
||||
make_merge_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2) {
|
||||
return sprout::merge_iterator<LIterator, RIterator>(it1, las1, it2, las2);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -56,33 +56,33 @@ namespace sprout {
|
|||
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
|
||||
protected:
|
||||
pair_type current;
|
||||
iterator_type lst_1;
|
||||
iterator2_type lst_2;
|
||||
iterator_type las1;
|
||||
iterator2_type las2;
|
||||
Compare comp;
|
||||
private:
|
||||
SPROUT_CONSTEXPR set_difference_iterator(set_difference_iterator const& other, pair_type const& next)
|
||||
: current(next)
|
||||
, lst_1(other.lst_1), lst_2(other.lst_2)
|
||||
, las1(other.las1), las2(other.las2)
|
||||
, comp(other.comp)
|
||||
{}
|
||||
public:
|
||||
SPROUT_CONSTEXPR set_difference_iterator()
|
||||
: current(), lst_1(), lst_2(), comp()
|
||||
: current(), las1(), las2(), comp()
|
||||
{}
|
||||
set_difference_iterator(set_difference_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR set_difference_iterator(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp = Compare()
|
||||
)
|
||||
: current(sprout::find_difference(it1, lst_1, it2, lst_2, comp))
|
||||
, lst_1(lst_1), lst_2(lst_2)
|
||||
: current(sprout::find_difference(it1, las1, it2, las2, comp))
|
||||
, las1(las1), las2(las2)
|
||||
, comp(comp)
|
||||
{}
|
||||
template<typename U, typename V, typename W>
|
||||
SPROUT_CONSTEXPR set_difference_iterator(set_difference_iterator<U, V, W> const& it)
|
||||
: current(it.base(), it.base2())
|
||||
, lst_1(it.last1()), lst_2(it.last2())
|
||||
, las1(it.last1()), las2(it.last2())
|
||||
, comp(it.compare())
|
||||
{}
|
||||
template<typename U, typename V, typename W>
|
||||
|
@ -95,13 +95,13 @@ namespace sprout {
|
|||
return current.first;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type last1() const {
|
||||
return lst_1;
|
||||
return las1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
||||
return current.second;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type last2() const {
|
||||
return lst_2;
|
||||
return las2;
|
||||
}
|
||||
SPROUT_CONSTEXPR Compare compare() const {
|
||||
return comp;
|
||||
|
@ -116,31 +116,31 @@ namespace sprout {
|
|||
return &*(*this);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_difference_iterator& operator++() {
|
||||
current = sprout::next_difference(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_difference(current.first, las1, current.second, las2, comp);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_difference_iterator operator++(int) {
|
||||
set_difference_iterator result(*this);
|
||||
current = sprout::next_difference(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_difference(current.first, las1, current.second, las2, comp);
|
||||
return result;
|
||||
}
|
||||
SPROUT_CONSTEXPR set_difference_iterator next() const {
|
||||
return set_difference_iterator(
|
||||
*this,
|
||||
sprout::next_difference(current.first, lst_1, current.second, lst_2, comp)
|
||||
sprout::next_difference(current.first, las1, current.second, las2, comp)
|
||||
);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR void swap(set_difference_iterator& other)
|
||||
SPROUT_NOEXCEPT_IF(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_1, other.lst_1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_2, other.lst_2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las1, other.las1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las2, other.las2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(lst_1, other.lst_1);
|
||||
sprout::swap(lst_2, other.lst_2);
|
||||
sprout::swap(las1, other.las1);
|
||||
sprout::swap(las2, other.las2);
|
||||
sprout::swap(comp, other.comp);
|
||||
}
|
||||
};
|
||||
|
@ -173,13 +173,13 @@ namespace sprout {
|
|||
//
|
||||
template<typename LIterator, typename RIterator, typename Compare>
|
||||
inline SPROUT_CONSTEXPR sprout::set_difference_iterator<LIterator, RIterator, Compare>
|
||||
make_set_difference_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2, Compare comp) {
|
||||
return sprout::set_difference_iterator<LIterator, RIterator, Compare>(it1, lst_1, it2, lst_2, comp);
|
||||
make_set_difference_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2, Compare comp) {
|
||||
return sprout::set_difference_iterator<LIterator, RIterator, Compare>(it1, las1, it2, las2, comp);
|
||||
}
|
||||
template<typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::set_difference_iterator<LIterator, RIterator>
|
||||
make_set_difference_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2) {
|
||||
return sprout::set_difference_iterator<LIterator, RIterator>(it1, lst_1, it2, lst_2);
|
||||
make_set_difference_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2) {
|
||||
return sprout::set_difference_iterator<LIterator, RIterator>(it1, las1, it2, las2);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -56,33 +56,33 @@ namespace sprout {
|
|||
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
|
||||
protected:
|
||||
pair_type current;
|
||||
iterator_type lst_1;
|
||||
iterator2_type lst_2;
|
||||
iterator_type las1;
|
||||
iterator2_type las2;
|
||||
Compare comp;
|
||||
private:
|
||||
SPROUT_CONSTEXPR set_intersection_iterator(set_intersection_iterator const& other, pair_type const& next)
|
||||
: current(next)
|
||||
, lst_1(other.lst_1), lst_2(other.lst_2)
|
||||
, las1(other.las1), las2(other.las2)
|
||||
, comp(other.comp)
|
||||
{}
|
||||
public:
|
||||
SPROUT_CONSTEXPR set_intersection_iterator()
|
||||
: current(), lst_1(), lst_2(), comp()
|
||||
: current(), las1(), las2(), comp()
|
||||
{}
|
||||
set_intersection_iterator(set_intersection_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR set_intersection_iterator(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp = Compare()
|
||||
)
|
||||
: current(sprout::find_intersection(it1, lst_1, it2, lst_2, comp))
|
||||
, lst_1(lst_1), lst_2(lst_2)
|
||||
: current(sprout::find_intersection(it1, las1, it2, las2, comp))
|
||||
, las1(las1), las2(las2)
|
||||
, 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())
|
||||
, lst_1(it.last1()), lst_2(it.last2())
|
||||
, las1(it.last1()), las2(it.last2())
|
||||
, comp(it.compare())
|
||||
{}
|
||||
template<typename U, typename V, typename W>
|
||||
|
@ -95,13 +95,13 @@ namespace sprout {
|
|||
return current.first;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type last1() const {
|
||||
return lst_1;
|
||||
return las1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
||||
return current.second;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type last2() const {
|
||||
return lst_2;
|
||||
return las2;
|
||||
}
|
||||
SPROUT_CONSTEXPR Compare compare() const {
|
||||
return comp;
|
||||
|
@ -116,31 +116,31 @@ namespace sprout {
|
|||
return &*(*this);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_intersection_iterator& operator++() {
|
||||
current = sprout::next_intersection(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_intersection(current.first, las1, current.second, las2, comp);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_intersection_iterator operator++(int) {
|
||||
set_intersection_iterator result(*this);
|
||||
current = sprout::next_intersection(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_intersection(current.first, las1, current.second, las2, comp);
|
||||
return result;
|
||||
}
|
||||
SPROUT_CONSTEXPR set_intersection_iterator next() const {
|
||||
return set_intersection_iterator(
|
||||
*this,
|
||||
sprout::next_intersection(current.first, lst_1, current.second, lst_2, comp)
|
||||
sprout::next_intersection(current.first, las1, current.second, las2, comp)
|
||||
);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR void swap(set_intersection_iterator& other)
|
||||
SPROUT_NOEXCEPT_IF(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_1, other.lst_1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_2, other.lst_2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las1, other.las1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las2, other.las2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(lst_1, other.lst_1);
|
||||
sprout::swap(lst_2, other.lst_2);
|
||||
sprout::swap(las1, other.las1);
|
||||
sprout::swap(las2, other.las2);
|
||||
sprout::swap(comp, other.comp);
|
||||
}
|
||||
};
|
||||
|
@ -173,13 +173,13 @@ namespace sprout {
|
|||
//
|
||||
template<typename LIterator, typename RIterator, typename Compare>
|
||||
inline SPROUT_CONSTEXPR sprout::set_intersection_iterator<LIterator, RIterator, Compare>
|
||||
make_set_intersection_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2, Compare comp) {
|
||||
return sprout::set_intersection_iterator<LIterator, RIterator, Compare>(it1, lst_1, it2, lst_2, comp);
|
||||
make_set_intersection_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2, Compare comp) {
|
||||
return sprout::set_intersection_iterator<LIterator, RIterator, Compare>(it1, las1, it2, las2, comp);
|
||||
}
|
||||
template<typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::set_intersection_iterator<LIterator, RIterator>
|
||||
make_set_intersection_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2) {
|
||||
return sprout::set_intersection_iterator<LIterator, RIterator>(it1, lst_1, it2, lst_2);
|
||||
make_set_intersection_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2) {
|
||||
return sprout::set_intersection_iterator<LIterator, RIterator>(it1, las1, it2, las2);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -43,45 +43,45 @@ namespace sprout {
|
|||
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
|
||||
protected:
|
||||
static SPROUT_CONSTEXPR bool check_in_left(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return it1 != lst_1 ? (it2 != lst_2 ? comp(*it1, *it2) : true)
|
||||
: !(it2 != lst_2)
|
||||
return it1 != las1 ? (it2 != las2 ? comp(*it1, *it2) : true)
|
||||
: !(it2 != las2)
|
||||
;
|
||||
}
|
||||
protected:
|
||||
pair_type current;
|
||||
iterator_type lst_1;
|
||||
iterator2_type lst_2;
|
||||
iterator_type las1;
|
||||
iterator2_type las2;
|
||||
Compare comp;
|
||||
protected:
|
||||
bool in_left;
|
||||
protected:
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator_impl()
|
||||
: current(), lst_1(), lst_2(), comp(), in_left(true)
|
||||
: current(), las1(), las2(), comp(), in_left(true)
|
||||
{}
|
||||
set_symmetric_difference_iterator_impl(set_symmetric_difference_iterator_impl const&) = default;
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator_impl(
|
||||
pair_type const& current,
|
||||
iterator_type lst_1, iterator2_type lst_2,
|
||||
iterator_type las1, iterator2_type las2,
|
||||
Compare comp
|
||||
)
|
||||
: current(current)
|
||||
, lst_1(lst_1), lst_2(lst_2)
|
||||
, las1(las1), las2(las2)
|
||||
, comp(comp)
|
||||
, in_left(check_in_left(current.first, lst_1, current.second, lst_2, comp))
|
||||
, in_left(check_in_left(current.first, las1, current.second, las2, comp))
|
||||
{}
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator_impl(
|
||||
pair_type const& current,
|
||||
iterator_type lst_1, iterator2_type lst_2,
|
||||
iterator_type las1, iterator2_type las2,
|
||||
Compare comp,
|
||||
bool in_left
|
||||
)
|
||||
: current(current)
|
||||
, lst_1(lst_1), lst_2(lst_2)
|
||||
, las1(las1), las2(las2)
|
||||
, comp(comp)
|
||||
, in_left(in_left)
|
||||
{}
|
||||
|
@ -125,14 +125,14 @@ namespace sprout {
|
|||
using impl_type::check_in_left;
|
||||
protected:
|
||||
using impl_type::current;
|
||||
using impl_type::lst_1;
|
||||
using impl_type::lst_2;
|
||||
using impl_type::las1;
|
||||
using impl_type::las2;
|
||||
using impl_type::comp;
|
||||
private:
|
||||
using impl_type::in_left;
|
||||
private:
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator(set_symmetric_difference_iterator const& other, pair_type const& next)
|
||||
: impl_type(next, other.lst_1, other.lst_2, other.comp)
|
||||
: impl_type(next, other.las1, other.las2, other.comp)
|
||||
{}
|
||||
public:
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator()
|
||||
|
@ -140,11 +140,11 @@ namespace sprout {
|
|||
{}
|
||||
set_symmetric_difference_iterator(set_symmetric_difference_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp = Compare()
|
||||
)
|
||||
: impl_type(sprout::find_symmetric_difference(it1, lst_1, it2, lst_2, comp), lst_1, lst_2, comp)
|
||||
: impl_type(sprout::find_symmetric_difference(it1, las1, it2, las2, comp), las1, las2, comp)
|
||||
{}
|
||||
template<typename U, typename V, typename W>
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator(set_symmetric_difference_iterator<U, V, W> const& it)
|
||||
|
@ -160,13 +160,13 @@ namespace sprout {
|
|||
return current.first;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type last1() const {
|
||||
return lst_1;
|
||||
return las1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
||||
return current.second;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type last2() const {
|
||||
return lst_2;
|
||||
return las2;
|
||||
}
|
||||
SPROUT_CONSTEXPR Compare compare() const {
|
||||
return comp;
|
||||
|
@ -181,33 +181,33 @@ namespace sprout {
|
|||
return &*(*this);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_symmetric_difference_iterator& operator++() {
|
||||
current = sprout::next_symmetric_difference(current.first, lst_1, current.second, lst_2, comp);
|
||||
in_left = check_in_left(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_symmetric_difference(current.first, las1, current.second, las2, comp);
|
||||
in_left = check_in_left(current.first, las1, current.second, las2, comp);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_symmetric_difference_iterator operator++(int) {
|
||||
set_symmetric_difference_iterator result(*this);
|
||||
current = sprout::next_symmetric_difference(current.first, lst_1, current.second, lst_2, comp);
|
||||
in_left = check_in_left(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_symmetric_difference(current.first, las1, current.second, las2, comp);
|
||||
in_left = check_in_left(current.first, las1, current.second, las2, comp);
|
||||
return result;
|
||||
}
|
||||
SPROUT_CONSTEXPR set_symmetric_difference_iterator next() const {
|
||||
return set_symmetric_difference_iterator(
|
||||
*this,
|
||||
sprout::next_symmetric_difference(current.first, lst_1, current.second, lst_2, comp)
|
||||
sprout::next_symmetric_difference(current.first, las1, current.second, las2, comp)
|
||||
);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR void swap(set_symmetric_difference_iterator& other)
|
||||
SPROUT_NOEXCEPT_IF(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_1, other.lst_1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_2, other.lst_2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las1, other.las1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las2, other.las2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(lst_1, other.lst_1);
|
||||
sprout::swap(lst_2, other.lst_2);
|
||||
sprout::swap(las1, other.las1);
|
||||
sprout::swap(las2, other.las2);
|
||||
sprout::swap(comp, other.comp);
|
||||
sprout::swap(in_left, other.in_left);
|
||||
}
|
||||
|
@ -241,13 +241,13 @@ namespace sprout {
|
|||
//
|
||||
template<typename LIterator, typename RIterator, typename Compare>
|
||||
inline SPROUT_CONSTEXPR sprout::set_symmetric_difference_iterator<LIterator, RIterator, Compare>
|
||||
make_set_symmetric_difference_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2, Compare comp) {
|
||||
return sprout::set_symmetric_difference_iterator<LIterator, RIterator, Compare>(it1, lst_1, it2, lst_2, comp);
|
||||
make_set_symmetric_difference_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2, Compare comp) {
|
||||
return sprout::set_symmetric_difference_iterator<LIterator, RIterator, Compare>(it1, las1, it2, las2, comp);
|
||||
}
|
||||
template<typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::set_symmetric_difference_iterator<LIterator, RIterator>
|
||||
make_set_symmetric_difference_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2) {
|
||||
return sprout::set_symmetric_difference_iterator<LIterator, RIterator>(it1, lst_1, it2, lst_2);
|
||||
make_set_symmetric_difference_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2) {
|
||||
return sprout::set_symmetric_difference_iterator<LIterator, RIterator>(it1, las1, it2, las2);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -55,48 +55,48 @@ namespace sprout {
|
|||
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
|
||||
private:
|
||||
static SPROUT_CONSTEXPR bool check_in_left(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return it1 != lst_1 ? (it2 != lst_2 ? comp(*it1, *it2) || !comp(*it2, *it1) : true)
|
||||
: !(it2 != lst_2)
|
||||
return it1 != las1 ? (it2 != las2 ? comp(*it1, *it2) || !comp(*it2, *it1) : true)
|
||||
: !(it2 != las2)
|
||||
;
|
||||
}
|
||||
protected:
|
||||
pair_type current;
|
||||
iterator_type lst_1;
|
||||
iterator2_type lst_2;
|
||||
iterator_type las1;
|
||||
iterator2_type las2;
|
||||
Compare comp;
|
||||
private:
|
||||
bool in_left;
|
||||
private:
|
||||
SPROUT_CONSTEXPR set_union_iterator(set_union_iterator const& other, pair_type const& next)
|
||||
: current(next)
|
||||
, lst_1(other.lst_1), lst_2(other.lst_2)
|
||||
, las1(other.las1), las2(other.las2)
|
||||
, comp(other.comp)
|
||||
, in_left(check_in_left(next.first, other.lst_1, next.second, other.lst_2, other.comp))
|
||||
, in_left(check_in_left(next.first, other.las1, next.second, other.las2, other.comp))
|
||||
{}
|
||||
public:
|
||||
SPROUT_CONSTEXPR set_union_iterator()
|
||||
: current(), lst_1(), lst_2(), comp(), in_left(true)
|
||||
: current(), las1(), las2(), comp(), in_left(true)
|
||||
{}
|
||||
set_union_iterator(set_union_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR set_union_iterator(
|
||||
iterator_type it1, iterator_type lst_1,
|
||||
iterator2_type it2, iterator2_type lst_2,
|
||||
iterator_type it1, iterator_type las1,
|
||||
iterator2_type it2, iterator2_type las2,
|
||||
Compare comp = Compare()
|
||||
)
|
||||
: current(it1, it2)
|
||||
, lst_1(lst_1), lst_2(lst_2)
|
||||
, las1(las1), las2(las2)
|
||||
, comp(comp)
|
||||
, in_left(check_in_left(it1, lst_1, it2, lst_2, comp))
|
||||
, in_left(check_in_left(it1, las1, it2, las2, comp))
|
||||
{}
|
||||
template<typename U, typename V, typename W>
|
||||
SPROUT_CONSTEXPR set_union_iterator(set_union_iterator<U, V, W> const& it)
|
||||
: current(it.base(), it.base2())
|
||||
, lst_1(it.last1()), lst_2(it.last2())
|
||||
, las1(it.last1()), las2(it.last2())
|
||||
, comp(it.compare())
|
||||
, in_left(it.is_in_left())
|
||||
{}
|
||||
|
@ -110,13 +110,13 @@ namespace sprout {
|
|||
return current.first;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type last1() const {
|
||||
return lst_1;
|
||||
return las1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
||||
return current.second;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type last2() const {
|
||||
return lst_2;
|
||||
return las2;
|
||||
}
|
||||
SPROUT_CONSTEXPR Compare compare() const {
|
||||
return comp;
|
||||
|
@ -131,33 +131,33 @@ namespace sprout {
|
|||
return &*(*this);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_union_iterator& operator++() {
|
||||
current = sprout::next_union(current.first, lst_1, current.second, lst_2, comp);
|
||||
in_left = check_in_left(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_union(current.first, las1, current.second, las2, comp);
|
||||
in_left = check_in_left(current.first, las1, current.second, las2, comp);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR set_union_iterator operator++(int) {
|
||||
set_union_iterator result(*this);
|
||||
current = sprout::next_union(current.first, lst_1, current.second, lst_2, comp);
|
||||
in_left = check_in_left(current.first, lst_1, current.second, lst_2, comp);
|
||||
current = sprout::next_union(current.first, las1, current.second, las2, comp);
|
||||
in_left = check_in_left(current.first, las1, current.second, las2, comp);
|
||||
return result;
|
||||
}
|
||||
SPROUT_CONSTEXPR set_union_iterator next() const {
|
||||
return set_union_iterator(
|
||||
*this,
|
||||
sprout::next_union(current.first, lst_1, current.second, lst_2, comp)
|
||||
sprout::next_union(current.first, las1, current.second, las2, comp)
|
||||
);
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR void swap(set_union_iterator& other)
|
||||
SPROUT_NOEXCEPT_IF(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_1, other.lst_1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_2, other.lst_2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las1, other.las1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(las2, other.las2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(comp, other.comp))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(lst_1, other.lst_1);
|
||||
sprout::swap(lst_2, other.lst_2);
|
||||
sprout::swap(las1, other.las1);
|
||||
sprout::swap(las2, other.las2);
|
||||
sprout::swap(comp, other.comp);
|
||||
sprout::swap(in_left, other.in_left);
|
||||
}
|
||||
|
@ -191,13 +191,13 @@ namespace sprout {
|
|||
//
|
||||
template<typename LIterator, typename RIterator, typename Compare>
|
||||
inline SPROUT_CONSTEXPR sprout::set_union_iterator<LIterator, RIterator, Compare>
|
||||
make_set_union_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2, Compare comp) {
|
||||
return sprout::set_union_iterator<LIterator, RIterator, Compare>(it1, lst_1, it2, lst_2, comp);
|
||||
make_set_union_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2, Compare comp) {
|
||||
return sprout::set_union_iterator<LIterator, RIterator, Compare>(it1, las1, it2, las2, comp);
|
||||
}
|
||||
template<typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::set_union_iterator<LIterator, RIterator>
|
||||
make_set_union_iterator(LIterator it1, LIterator lst_1, RIterator it2, RIterator lst_2) {
|
||||
return sprout::set_union_iterator<LIterator, RIterator>(it1, lst_1, it2, lst_2);
|
||||
make_set_union_iterator(LIterator it1, LIterator las1, RIterator it2, RIterator las2) {
|
||||
return sprout::set_union_iterator<LIterator, RIterator>(it1, las1, it2, las2);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue