summaryrefslogtreecommitdiff
path: root/boost/move/algo/detail/merge.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/move/algo/detail/merge.hpp')
-rw-r--r--boost/move/algo/detail/merge.hpp80
1 files changed, 10 insertions, 70 deletions
diff --git a/boost/move/algo/detail/merge.hpp b/boost/move/algo/detail/merge.hpp
index 988ffd35be..621dfa28af 100644
--- a/boost/move/algo/detail/merge.hpp
+++ b/boost/move/algo/detail/merge.hpp
@@ -16,6 +16,8 @@
#include <boost/move/algo/detail/basic_op.hpp>
#include <boost/move/detail/iterator_traits.hpp>
#include <boost/move/detail/destruct_n.hpp>
+#include <boost/move/algo/predicate.hpp>
+#include <boost/move/detail/iterator_to_raw_pointer.hpp>
#include <boost/assert.hpp>
namespace boost {
@@ -181,9 +183,6 @@ void op_merge_left( RandIt buf_first
//and all elements from the second half are less)
op(forward_t(), first1, last1, buf_first);
}
- else{
- buf_first = buf_first;
- }
}
// [buf_first, first1) -> buffer
@@ -312,13 +311,13 @@ void merge_bufferless_ONlogN_recursive
if (len1 > len2) {
len11 = len1 / 2;
first_cut += len11;
- second_cut = lower_bound(middle, last, *first_cut, comp);
+ second_cut = boost::movelib::lower_bound(middle, last, *first_cut, comp);
len22 = size_type(second_cut - middle);
}
else {
len22 = len2 / 2;
second_cut += len22;
- first_cut = upper_bound(first, middle, *second_cut, comp);
+ first_cut = boost::movelib::upper_bound(first, middle, *second_cut, comp);
len11 = size_type(first_cut - first);
}
BidirIt new_middle = rotate_gcd(first_cut, middle, second_cut);
@@ -359,7 +358,7 @@ void merge_bufferless_ON2(RandIt first, RandIt middle, RandIt last, Compare comp
if((middle - first) < (last - middle)){
while(first != middle){
RandIt const old_last1 = middle;
- middle = lower_bound(middle, last, *first, comp);
+ middle = boost::movelib::lower_bound(middle, last, *first, comp);
first = rotate_gcd(first, old_last1, middle);
if(middle == last){
break;
@@ -371,7 +370,7 @@ void merge_bufferless_ON2(RandIt first, RandIt middle, RandIt last, Compare comp
}
else{
while(middle != last){
- RandIt p = upper_bound(first, middle, last[-1], comp);
+ RandIt p = boost::movelib::upper_bound(first, middle, last[-1], comp);
last = rotate_gcd(p, middle, last);
middle = p;
if(middle == first){
@@ -396,65 +395,6 @@ void merge_bufferless(RandIt first, RandIt middle, RandIt last, Compare comp)
#endif //BOOST_ADAPTIVE_MERGE_NLOGN_MERGE
}
-template<class Comp>
-struct antistable
-{
- explicit antistable(Comp &comp)
- : m_comp(comp)
- {}
-
- template<class U, class V>
- bool operator()(const U &u, const V & v)
- { return !m_comp(v, u); }
-
- private:
- antistable & operator=(const antistable &);
- Comp &m_comp;
-};
-
-template <class Comp>
-class negate
-{
- public:
- negate()
- {}
-
- explicit negate(Comp comp)
- : m_comp(comp)
- {}
-
- template <class T1, class T2>
- bool operator()(const T1& l, const T2& r)
- {
- return !m_comp(l, r);
- }
-
- private:
- Comp m_comp;
-};
-
-
-template <class Comp>
-class inverse
-{
- public:
- inverse()
- {}
-
- explicit inverse(Comp comp)
- : m_comp(comp)
- {}
-
- template <class T1, class T2>
- bool operator()(const T1& l, const T2& r)
- {
- return m_comp(r, l);
- }
-
- private:
- Comp m_comp;
-};
-
// [r_first, r_last) are already in the right part of the destination range.
template <class Compare, class InputIterator, class InputOutIterator, class Op>
void op_merge_with_right_placed
@@ -557,12 +497,12 @@ void uninitialized_merge_with_right_placed
typedef typename iterator_traits<InputOutIterator>::value_type value_type;
InputOutIterator const original_r_first = r_first;
- destruct_n<value_type> d(&*dest_first);
+ destruct_n<value_type, InputOutIterator> d(dest_first);
while ( first != last && dest_first != original_r_first ) {
if (r_first == r_last) {
for(; dest_first != original_r_first; ++dest_first, ++first){
- ::new(&*dest_first) value_type(::boost::move(*first));
+ ::new((iterator_to_raw_pointer)(dest_first)) value_type(::boost::move(*first));
d.incr();
}
d.release();
@@ -572,12 +512,12 @@ void uninitialized_merge_with_right_placed
return;
}
else if (comp(*r_first, *first)) {
- ::new(&*dest_first) value_type(::boost::move(*r_first));
+ ::new((iterator_to_raw_pointer)(dest_first)) value_type(::boost::move(*r_first));
d.incr();
++r_first;
}
else {
- ::new(&*dest_first) value_type(::boost::move(*first));
+ ::new((iterator_to_raw_pointer)(dest_first)) value_type(::boost::move(*first));
d.incr();
++first;
}