diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:05:34 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:06:28 +0900 |
commit | 34bd32e225e2a8a94104489b31c42e5801cc1f4a (patch) | |
tree | d021b579a0c190354819974e1eaf0baa54b551f3 /boost/move/algo/detail/merge.hpp | |
parent | f763a99a501650eff2c60288aa6f10ef916d769e (diff) | |
download | boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.tar.gz boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.tar.bz2 boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.zip |
Imported Upstream version 1.63.0upstream/1.63.0
Change-Id: Iac85556a04b7e58d63ba636dedb0986e3555714a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/move/algo/detail/merge.hpp')
-rw-r--r-- | boost/move/algo/detail/merge.hpp | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/boost/move/algo/detail/merge.hpp b/boost/move/algo/detail/merge.hpp index 11d5740a6a..988ffd35be 100644 --- a/boost/move/algo/detail/merge.hpp +++ b/boost/move/algo/detail/merge.hpp @@ -492,7 +492,7 @@ void swap_merge_with_right_placed op_merge_with_right_placed(first, last, dest_first, r_first, r_last, comp, swap_op()); } -// [r_first, r_last) are already in the right part of the destination range. +// [first, last) are already in the right part of the destination range. template <class Compare, class Op, class BidirIterator, class BidirOutIterator> void op_merge_with_left_placed ( BidirOutIterator const first, BidirOutIterator last, BidirOutIterator dest_last @@ -525,7 +525,7 @@ void op_merge_with_left_placed // @endcond -// [r_first, r_last) are already in the right part of the destination range. +// [irst, last) are already in the right part of the destination range. template <class Compare, class BidirIterator, class BidirOutIterator> void merge_with_left_placed ( BidirOutIterator const first, BidirOutIterator last, BidirOutIterator dest_last @@ -587,6 +587,50 @@ void uninitialized_merge_with_right_placed merge_with_right_placed(first, last, original_r_first, r_first, r_last, comp); } +/* +// [r_first, r_last) are already in the right part of the destination range. +// [dest_first, r_first) is uninitialized memory +template <class Compare, class BidirOutIterator, class BidirIterator> +void uninitialized_merge_with_left_placed + ( BidirOutIterator dest_first, BidirOutIterator r_first, BidirOutIterator r_last + , BidirIterator first, BidirIterator last + , Compare comp) +{ + BOOST_ASSERT((last - first) == (r_last - r_first)); + typedef typename iterator_traits<BidirOutIterator>::value_type value_type; + BidirOutIterator const original_r_last = r_last; + + destruct_n<value_type> d(&*dest_last); + + 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)); + d.incr(); + } + d.release(); + BidirOutIterator end = ::boost::move(first, last, original_r_first); + BOOST_ASSERT(end == r_last); + (void)end; + return; + } + else if (comp(*r_first, *first)) { + ::new(&*dest_first) value_type(::boost::move(*r_first)); + d.incr(); + ++r_first; + } + else { + ::new(&*dest_first) value_type(::boost::move(*first)); + d.incr(); + ++first; + } + ++dest_first; + } + d.release(); + merge_with_right_placed(first, last, original_r_first, r_first, r_last, comp); +} +*/ + } //namespace movelib { } //namespace boost { |