fix for Issue #82 (conflict windows.h macro)

This commit is contained in:
bolero-MURAKAMI 2016-03-08 12:26:33 +09:00
parent 1fabe7da1c
commit f0ba8fad5d
6 changed files with 167 additions and 167 deletions

View file

@ -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 lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp
)
{
return it1 != lst1 ? (it2 != lst2 ? !comp(*it2, *it1) : true)
: !(it2 != lst2)
return it1 != lst_1 ? (it2 != lst_2 ? !comp(*it2, *it1) : true)
: !(it2 != lst_2)
;
}
protected:
iterator_type current1;
iterator_type lst1;
iterator_type lst_1;
iterator2_type current2;
iterator2_type lst2;
iterator2_type lst_2;
Compare comp;
bool in_left;
public:
SPROUT_CONSTEXPR merge_iterator()
: current1(), lst1(), current2(), lst2(), comp(), in_left(true)
: current1(), lst_1(), current2(), lst_2(), comp(), in_left(true)
{}
merge_iterator(merge_iterator const&) = default;
SPROUT_CONSTEXPR merge_iterator(
iterator_type it1, iterator_type lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp = Compare()
)
: current1(it1), lst1(lst1)
, current2(it2), lst2(lst2)
: current1(it1), lst_1(lst_1)
, current2(it2), lst_2(lst_2)
, comp(comp)
, in_left(check_in_left(it1, lst1, it2, lst2, comp))
, in_left(check_in_left(it1, lst_1, it2, lst_2, comp))
{}
template<typename U, typename V, typename W>
SPROUT_CONSTEXPR merge_iterator(merge_iterator<U, V, W> const& it)
: current1(it.base()), lst1(it.last1())
, current2(it.base2()), lst2(it.last2())
: current1(it.base()), lst_1(it.last1())
, current2(it.base2()), lst_2(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 lst1;
return lst_1;
}
SPROUT_CONSTEXPR iterator2_type base2() const {
return current2;
}
SPROUT_CONSTEXPR iterator2_type last2() const {
return lst2;
return lst_2;
}
SPROUT_CONSTEXPR Compare compare() const {
return comp;
@ -120,8 +120,8 @@ namespace sprout {
return &*(*this);
}
SPROUT_CXX14_CONSTEXPR merge_iterator& operator++() {
if (current1 != lst1) {
if (current2 != lst2) {
if (current1 != lst_1) {
if (current2 != lst_2) {
if (comp(*current2, *current1)) {
++current2;
} else {
@ -130,16 +130,16 @@ namespace sprout {
} else {
++current1;
}
} else if (current2 != lst2) {
} else if (current2 != lst_2) {
++current2;
}
in_left = check_in_left(current1, lst1, current2, lst2, comp);
in_left = check_in_left(current1, lst_1, current2, lst_2, comp);
return *this;
}
SPROUT_CXX14_CONSTEXPR merge_iterator operator++(int) {
merge_iterator result(*this);
if (current1 != lst1) {
if (current2 != lst2) {
if (current1 != lst_1) {
if (current2 != lst_2) {
if (comp(*current2, *current1)) {
++current2;
} else {
@ -148,38 +148,38 @@ namespace sprout {
} else {
++current1;
}
} else if (current2 != lst2) {
} else if (current2 != lst_2) {
++current2;
}
in_left = check_in_left(current1, lst1, current2, lst2, comp);
in_left = check_in_left(current1, lst_1, current2, lst_2, comp);
return result;
}
SPROUT_CONSTEXPR merge_iterator next() const {
return current1 != lst1
? current2 != lst2
return current1 != lst_1
? current2 != lst_2
? comp(*current2, *current1)
? merge_iterator(current1, lst1, sprout::next(current2), lst2, comp)
: merge_iterator(sprout::next(current1), lst1, current2, lst2, comp)
: merge_iterator(sprout::next(current1), lst1, current2, lst2, comp)
: current2 != lst2
? merge_iterator(current1, lst1, sprout::next(current2), lst2, comp)
? 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)
: *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(lst1, other.lst1))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_1, other.lst_1))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(current2, other.current2))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst_2, other.lst_2))
&& 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(lst1, other.lst1);
sprout::swap(lst_1, other.lst_1);
sprout::swap(current2, other.current2);
sprout::swap(lst2, other.lst2);
sprout::swap(lst_2, other.lst_2);
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 lst1, RIterator it2, RIterator lst2, Compare comp) {
return sprout::merge_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
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);
}
template<typename LIterator, typename RIterator>
inline SPROUT_CONSTEXPR sprout::merge_iterator<LIterator, RIterator>
make_merge_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2) {
return sprout::merge_iterator<LIterator, RIterator>(it1, lst1, it2, lst2);
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);
}
//

View file

@ -46,23 +46,23 @@ namespace sprout {
? remake_iterator(
sprout::next(current, n),
begin_off - n >= 0 ? fst
: (end_off - begin_off >= sprout::distance(fst, lst) && begin_off - n <= -sprout::distance(fst, lst)) ? lst
: (end_off - begin_off >= sprout::distance(fst, lst_) && begin_off - n <= -sprout::distance(fst, lst_)) ? lst_
: begin_off <= 0
? sprout::next(current2, NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::min(n, end_off), sprout::distance(current2, lst)))
: sprout::next(current2, NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::min(n - begin_off, end_off), sprout::distance(current2, lst)))
? sprout::next(current2, NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::min(n, end_off), sprout::distance(current2, lst_)))
: sprout::next(current2, NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::min(n - begin_off, end_off), sprout::distance(current2, lst_)))
,
fst, lst,
fst, lst_,
begin_off - n, end_off - n
)
: remake_iterator(
sprout::next(current, n),
begin_off - n >= 0 ? fst
: (end_off - begin_off >= sprout::distance(fst, lst) && begin_off - n <= -sprout::distance(fst, lst)) ? lst
: begin_off >= -sprout::distance(fst, lst)
: (end_off - begin_off >= sprout::distance(fst, lst_) && begin_off - n <= -sprout::distance(fst, lst_)) ? lst_
: begin_off >= -sprout::distance(fst, lst_)
? sprout::next(current2, n)
: sprout::next(current2, n - (begin_off + sprout::distance(fst, lst)))
: sprout::next(current2, n - (begin_off + sprout::distance(fst, lst_)))
,
fst, lst,
fst, lst_,
begin_off - n, end_off - n
)
;
@ -71,29 +71,29 @@ namespace sprout {
iterator_type current;
iterator2_type current2;
iterator2_type fst;
iterator2_type lst;
iterator2_type lst_;
difference_type begin_off;
difference_type end_off;
public:
SPROUT_CONSTEXPR remake_iterator()
: current(), current2()
, fst(), lst()
, fst(), lst_()
, begin_off(), end_off()
{}
SPROUT_CONSTEXPR remake_iterator(remake_iterator const& other)
: current(other.current), current2(other.current2)
, fst(other.fst), lst(other.lst)
, fst(other.fst), lst_(other.lst_)
, begin_off(other.begin_off), end_off(other.end_off)
{}
SPROUT_CONSTEXPR remake_iterator(iterator_type it, iterator2_type it2, iterator2_type fst, iterator2_type lst, difference_type begin_off, difference_type end_off)
SPROUT_CONSTEXPR remake_iterator(iterator_type it, iterator2_type it2, iterator2_type fst, iterator2_type lst_, difference_type begin_off, difference_type end_off)
: current(it), current2(it2)
, fst(fst), lst(lst)
, fst(fst), lst_(lst_)
, begin_off(begin_off), end_off(end_off)
{}
template<typename U, typename V>
SPROUT_CONSTEXPR remake_iterator(remake_iterator<U, V> const& it)
: current(it.base()), current2(it.base2())
, fst(it.first()), lst(it.last())
, fst(it.first()), lst_(it.last())
, begin_off(it.begin_offset()), end_off(it.end_offset())
{}
template<typename U, typename V>
@ -112,7 +112,7 @@ namespace sprout {
return fst;
}
SPROUT_CONSTEXPR iterator2_type last() const {
return lst;
return lst_;
}
SPROUT_CONSTEXPR difference_type begin_offset() const {
return begin_off;
@ -121,7 +121,7 @@ namespace sprout {
return end_off;
}
SPROUT_CONSTEXPR bool is_in_copying() const {
return begin_off <= 0 && end_off > 0 && current2 != lst;
return begin_off <= 0 && end_off > 0 && current2 != lst_;
}
SPROUT_CONSTEXPR reference operator*() const {
return is_in_copying() ? *current2 : *current;
@ -189,14 +189,14 @@ namespace sprout {
SPROUT_CONSTEXPR remake_iterator next() const {
return remake_iterator(
sprout::next(current), (is_in_copying() ? sprout::next(current2) : current2),
fst, lst,
fst, lst_,
begin_off - 1, end_off - 1
);
}
SPROUT_CONSTEXPR remake_iterator prev() const {
return remake_iterator(
sprout::prev(current), (begin_off < 0 && end_off >= 0 ? sprout::prev(current2) : current2),
fst, lst,
fst, lst_,
begin_off + 1, end_off + 1
);
}
@ -205,7 +205,7 @@ namespace sprout {
SPROUT_NOEXCEPT_EXPR(swap(current, other.current))
&& SPROUT_NOEXCEPT_EXPR(swap(current2, other.current2))
&& SPROUT_NOEXCEPT_EXPR(swap(fst, other.fst))
&& SPROUT_NOEXCEPT_EXPR(swap(lst, other.lst))
&& SPROUT_NOEXCEPT_EXPR(swap(lst_, other.lst_))
&& SPROUT_NOEXCEPT_EXPR(swap(begin_off, other.begin_off))
&& SPROUT_NOEXCEPT_EXPR(swap(end_off, other.end_off))
)
@ -213,7 +213,7 @@ namespace sprout {
swap(current, other.current);
swap(current2, other.current2);
swap(fst, other.fst);
swap(lst, other.lst);
swap(lst_, other.lst_);
swap(begin_off, other.begin_off);
swap(end_off, other.end_off);
}
@ -313,12 +313,12 @@ namespace sprout {
inline SPROUT_CONSTEXPR sprout::remake_iterator<DstIterator, SrcIterator>
make_remake_iterator(
DstIterator it, SrcIterator it2,
SrcIterator fst, SrcIterator lst,
SrcIterator fst, SrcIterator lst_,
typename sprout::remake_iterator<DstIterator, SrcIterator>::difference_type begin_off,
typename sprout::remake_iterator<DstIterator, SrcIterator>::difference_type end_off
)
{
return sprout::remake_iterator<DstIterator, SrcIterator>(it, it2, fst, lst, begin_off, end_off);
return sprout::remake_iterator<DstIterator, SrcIterator>(it, it2, fst, lst_, begin_off, end_off);
}
//

View file

@ -56,33 +56,33 @@ namespace sprout {
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
protected:
pair_type current;
iterator_type lst1;
iterator2_type lst2;
iterator_type lst_1;
iterator2_type lst_2;
Compare comp;
private:
SPROUT_CONSTEXPR set_difference_iterator(set_difference_iterator const& other, pair_type const& next)
: current(next)
, lst1(other.lst1), lst2(other.lst2)
, lst_1(other.lst_1), lst_2(other.lst_2)
, comp(other.comp)
{}
public:
SPROUT_CONSTEXPR set_difference_iterator()
: current(), lst1(), lst2(), comp()
: current(), lst_1(), lst_2(), comp()
{}
set_difference_iterator(set_difference_iterator const&) = default;
SPROUT_CONSTEXPR set_difference_iterator(
iterator_type it1, iterator_type lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp = Compare()
)
: current(sprout::find_difference(it1, lst1, it2, lst2, comp))
, lst1(lst1), lst2(lst2)
: current(sprout::find_difference(it1, lst_1, it2, lst_2, comp))
, lst_1(lst_1), lst_2(lst_2)
, 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())
, lst1(it.last1()), lst2(it.last2())
, lst_1(it.last1()), lst_2(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 lst1;
return lst_1;
}
SPROUT_CONSTEXPR iterator2_type base2() const {
return current.second;
}
SPROUT_CONSTEXPR iterator2_type last2() const {
return lst2;
return lst_2;
}
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, lst1, current.second, lst2, comp);
current = sprout::next_difference(current.first, lst_1, current.second, lst_2, comp);
return *this;
}
SPROUT_CXX14_CONSTEXPR set_difference_iterator operator++(int) {
set_difference_iterator result(*this);
current = sprout::next_difference(current.first, lst1, current.second, lst2, comp);
current = sprout::next_difference(current.first, lst_1, current.second, lst_2, comp);
return result;
}
SPROUT_CONSTEXPR set_difference_iterator next() const {
return set_difference_iterator(
*this,
sprout::next_difference(current.first, lst1, current.second, lst2, comp)
sprout::next_difference(current.first, lst_1, current.second, lst_2, 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(lst1, other.lst1))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
&& 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(comp, other.comp))
)
{
sprout::swap(current, other.current);
sprout::swap(lst1, other.lst1);
sprout::swap(lst2, other.lst2);
sprout::swap(lst_1, other.lst_1);
sprout::swap(lst_2, other.lst_2);
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 lst1, RIterator it2, RIterator lst2, Compare comp) {
return sprout::set_difference_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
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);
}
template<typename LIterator, typename RIterator>
inline SPROUT_CONSTEXPR sprout::set_difference_iterator<LIterator, RIterator>
make_set_difference_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2) {
return sprout::set_difference_iterator<LIterator, RIterator>(it1, lst1, it2, lst2);
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);
}
//

View file

@ -56,33 +56,33 @@ namespace sprout {
typedef sprout::pair<iterator_type, iterator2_type> pair_type;
protected:
pair_type current;
iterator_type lst1;
iterator2_type lst2;
iterator_type lst_1;
iterator2_type lst_2;
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)
, lst_1(other.lst_1), lst_2(other.lst_2)
, comp(other.comp)
{}
public:
SPROUT_CONSTEXPR set_intersection_iterator()
: current(), lst1(), lst2(), comp()
: current(), lst_1(), lst_2(), 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,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp = Compare()
)
: current(sprout::find_intersection(it1, lst1, it2, lst2, comp))
, lst1(lst1), lst2(lst2)
: current(sprout::find_intersection(it1, lst_1, it2, lst_2, comp))
, lst_1(lst_1), lst_2(lst_2)
, 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())
, lst_1(it.last1()), lst_2(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 lst1;
return lst_1;
}
SPROUT_CONSTEXPR iterator2_type base2() const {
return current.second;
}
SPROUT_CONSTEXPR iterator2_type last2() const {
return lst2;
return lst_2;
}
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, lst1, current.second, lst2, comp);
current = sprout::next_intersection(current.first, lst_1, current.second, lst_2, comp);
return *this;
}
SPROUT_CXX14_CONSTEXPR set_intersection_iterator operator++(int) {
set_intersection_iterator result(*this);
current = sprout::next_intersection(current.first, lst1, current.second, lst2, comp);
current = sprout::next_intersection(current.first, lst_1, current.second, lst_2, 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)
sprout::next_intersection(current.first, lst_1, current.second, lst_2, 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(lst1, other.lst1))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
&& 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(comp, other.comp))
)
{
sprout::swap(current, other.current);
sprout::swap(lst1, other.lst1);
sprout::swap(lst2, other.lst2);
sprout::swap(lst_1, other.lst_1);
sprout::swap(lst_2, other.lst_2);
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 lst1, RIterator it2, RIterator lst2, Compare comp) {
return sprout::set_intersection_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
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);
}
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);
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);
}
//

View file

@ -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 lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp
)
{
return it1 != lst1 ? (it2 != lst2 ? comp(*it1, *it2) : true)
: !(it2 != lst2)
return it1 != lst_1 ? (it2 != lst_2 ? comp(*it1, *it2) : true)
: !(it2 != lst_2)
;
}
protected:
pair_type current;
iterator_type lst1;
iterator2_type lst2;
iterator_type lst_1;
iterator2_type lst_2;
Compare comp;
protected:
bool in_left;
protected:
SPROUT_CONSTEXPR set_symmetric_difference_iterator_impl()
: current(), lst1(), lst2(), comp(), in_left(true)
: current(), lst_1(), lst_2(), 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 lst1, iterator2_type lst2,
iterator_type lst_1, iterator2_type lst_2,
Compare comp
)
: current(current)
, lst1(lst1), lst2(lst2)
, lst_1(lst_1), lst_2(lst_2)
, comp(comp)
, in_left(check_in_left(current.first, lst1, current.second, lst2, comp))
, in_left(check_in_left(current.first, lst_1, current.second, lst_2, comp))
{}
SPROUT_CONSTEXPR set_symmetric_difference_iterator_impl(
pair_type const& current,
iterator_type lst1, iterator2_type lst2,
iterator_type lst_1, iterator2_type lst_2,
Compare comp,
bool in_left
)
: current(current)
, lst1(lst1), lst2(lst2)
, lst_1(lst_1), lst_2(lst_2)
, 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::lst1;
using impl_type::lst2;
using impl_type::lst_1;
using impl_type::lst_2;
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.lst1, other.lst2, other.comp)
: impl_type(next, other.lst_1, other.lst_2, 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 lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp = Compare()
)
: impl_type(sprout::find_symmetric_difference(it1, lst1, it2, lst2, comp), lst1, lst2, comp)
: impl_type(sprout::find_symmetric_difference(it1, lst_1, it2, lst_2, comp), lst_1, lst_2, 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 lst1;
return lst_1;
}
SPROUT_CONSTEXPR iterator2_type base2() const {
return current.second;
}
SPROUT_CONSTEXPR iterator2_type last2() const {
return lst2;
return lst_2;
}
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, lst1, current.second, lst2, comp);
in_left = check_in_left(current.first, lst1, current.second, lst2, comp);
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);
return *this;
}
SPROUT_CXX14_CONSTEXPR set_symmetric_difference_iterator operator++(int) {
set_symmetric_difference_iterator result(*this);
current = sprout::next_symmetric_difference(current.first, lst1, current.second, lst2, comp);
in_left = check_in_left(current.first, lst1, current.second, lst2, comp);
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);
return result;
}
SPROUT_CONSTEXPR set_symmetric_difference_iterator next() const {
return set_symmetric_difference_iterator(
*this,
sprout::next_symmetric_difference(current.first, lst1, current.second, lst2, comp)
sprout::next_symmetric_difference(current.first, lst_1, current.second, lst_2, 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(lst1, other.lst1))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
&& 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(comp, other.comp))
)
{
sprout::swap(current, other.current);
sprout::swap(lst1, other.lst1);
sprout::swap(lst2, other.lst2);
sprout::swap(lst_1, other.lst_1);
sprout::swap(lst_2, other.lst_2);
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 lst1, RIterator it2, RIterator lst2, Compare comp) {
return sprout::set_symmetric_difference_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
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);
}
template<typename LIterator, typename RIterator>
inline SPROUT_CONSTEXPR sprout::set_symmetric_difference_iterator<LIterator, RIterator>
make_set_symmetric_difference_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2) {
return sprout::set_symmetric_difference_iterator<LIterator, RIterator>(it1, lst1, it2, lst2);
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);
}
//

View file

@ -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 lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp
)
{
return it1 != lst1 ? (it2 != lst2 ? comp(*it1, *it2) || !comp(*it2, *it1) : true)
: !(it2 != lst2)
return it1 != lst_1 ? (it2 != lst_2 ? comp(*it1, *it2) || !comp(*it2, *it1) : true)
: !(it2 != lst_2)
;
}
protected:
pair_type current;
iterator_type lst1;
iterator2_type lst2;
iterator_type lst_1;
iterator2_type lst_2;
Compare comp;
private:
bool in_left;
private:
SPROUT_CONSTEXPR set_union_iterator(set_union_iterator const& other, pair_type const& next)
: current(next)
, lst1(other.lst1), lst2(other.lst2)
, lst_1(other.lst_1), lst_2(other.lst_2)
, comp(other.comp)
, in_left(check_in_left(next.first, other.lst1, next.second, other.lst2, other.comp))
, in_left(check_in_left(next.first, other.lst_1, next.second, other.lst_2, other.comp))
{}
public:
SPROUT_CONSTEXPR set_union_iterator()
: current(), lst1(), lst2(), comp(), in_left(true)
: current(), lst_1(), lst_2(), comp(), in_left(true)
{}
set_union_iterator(set_union_iterator const&) = default;
SPROUT_CONSTEXPR set_union_iterator(
iterator_type it1, iterator_type lst1,
iterator2_type it2, iterator2_type lst2,
iterator_type it1, iterator_type lst_1,
iterator2_type it2, iterator2_type lst_2,
Compare comp = Compare()
)
: current(it1, it2)
, lst1(lst1), lst2(lst2)
, lst_1(lst_1), lst_2(lst_2)
, comp(comp)
, in_left(check_in_left(it1, lst1, it2, lst2, comp))
, in_left(check_in_left(it1, lst_1, it2, lst_2, 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())
, lst1(it.last1()), lst2(it.last2())
, lst_1(it.last1()), lst_2(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 lst1;
return lst_1;
}
SPROUT_CONSTEXPR iterator2_type base2() const {
return current.second;
}
SPROUT_CONSTEXPR iterator2_type last2() const {
return lst2;
return lst_2;
}
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, lst1, current.second, lst2, comp);
in_left = check_in_left(current.first, lst1, current.second, lst2, comp);
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);
return *this;
}
SPROUT_CXX14_CONSTEXPR set_union_iterator operator++(int) {
set_union_iterator result(*this);
current = sprout::next_union(current.first, lst1, current.second, lst2, comp);
in_left = check_in_left(current.first, lst1, current.second, lst2, comp);
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);
return result;
}
SPROUT_CONSTEXPR set_union_iterator next() const {
return set_union_iterator(
*this,
sprout::next_union(current.first, lst1, current.second, lst2, comp)
sprout::next_union(current.first, lst_1, current.second, lst_2, 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(lst1, other.lst1))
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
&& 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(comp, other.comp))
)
{
sprout::swap(current, other.current);
sprout::swap(lst1, other.lst1);
sprout::swap(lst2, other.lst2);
sprout::swap(lst_1, other.lst_1);
sprout::swap(lst_2, other.lst_2);
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 lst1, RIterator it2, RIterator lst2, Compare comp) {
return sprout::set_union_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
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);
}
template<typename LIterator, typename RIterator>
inline SPROUT_CONSTEXPR sprout::set_union_iterator<LIterator, RIterator>
make_set_union_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2) {
return sprout::set_union_iterator<LIterator, RIterator>(it1, lst1, it2, lst2);
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);
}
//