hpx/parallel/util/range.hpp

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace parallel
namespace util

Typedefs

template<typename Iterator, typename Sentinel = Iterator>
using range = hpx::util::iterator_range<Iterator, Sentinel>

Functions

template<typename Iter, typename Sent>
range<Iter, Sent> concat(range<Iter, Sent> const &it1, range<Iter, Sent> const &it2)

concatenate two contiguous ranges

Return

range resulting of the concatenation

Parameters
  • [in] it1: : first range

  • [in] it2: : second range

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2>
range<Iter2, Iter2> init_move(range<Iter2, Sent2> const &dest, range<Iter1, Sent1> const &src)

Move objects from the range src to dest.

Return

range with the objects moved and the size adjusted

Parameters
  • [in] dest: : range where move the objects

  • [in] src: : range from where move the objects

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2>
range<Iter2, Sent2> uninit_move(range<Iter2, Sent2> const &dest, range<Iter1, Sent1> const &src)

Move objects from the range src creating them in dest.

Return

range with the objects moved and the size adjusted

Parameters
  • [in] dest: : range where move and create the objects

  • [in] src: : range from where move the objects

template<typename Iter, typename Sent>
void destroy_range(range<Iter, Sent> r)

destroy a range of objects

Parameters
  • [in] r: : range to destroy

template<typename Iter, typename Sent>
range<Iter, Sent> init(range<Iter, Sent> const &r, typename std::iterator_traits<Iter>::value_type &val)

initialize a range of objects with the object val moving across them

Return

range initialized

Parameters
  • [in] r: : range of elements not initialized

  • [in] val: : object used for the initialization

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Compare>
bool is_mergeable(range<Iter1, Sent1> const &src1, range<Iter2, Sent2> const &src2, Compare comp)

: indicate if two ranges have a possible merge

Parameters
  • [in] src1: : first range

  • [in] src2: : second range

  • [in] comp: : object for to compare elements

Exceptions

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Iter3, typename Sent3, typename Compare>
range<Iter3, Sent3> full_merge(range<Iter3, Sent3> const &dest, range<Iter1, Sent1> const &src1, range<Iter2, Sent2> const &src2, Compare comp)

Merge two contiguous ranges src1 and src2 , and put the result in the range dest, returning the range merged.

Return

range with the elements merged and the size adjusted

Parameters
  • [in] dest: : range where locate the lements merged. the size of dest must be greater or equal than the sum of the sizes of src1 and src2

  • [in] src1: : first range to merge

  • [in] src2: : second range to merge

  • [in] comp: : comparison object

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Value, typename Compare>
range<Value*> uninit_full_merge(const range<Value*> &dest, range<Iter1, Sent1> const &src1, range<Iter2, Sent2> const &src2, Compare comp)

Merge two contiguous ranges src1 and src2 , and create and move the result in the uninitialized range dest, returning the range merged.

Return

range with the elements merged and the size adjusted

Parameters
  • [in] dest: : range where locate the elements merged. the size of dest must be greater or equal than the sum of the sizes of src1 and src2. Initially is uninitialize memory

  • [in] src1: : first range to merge

  • [in] src2: : second range to merge

  • [in] comp: : comparison object

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Compare>
range<Iter2, Sent2> half_merge(range<Iter2, Sent2> const &dest, range<Iter1, Sent1> const &src1, range<Iter2, Sent2> const &src2, Compare comp)

: Merge two buffers. The first buffer is in a separate memory

Return

: range with the two buffers merged

Parameters
  • [in] dest: : range where finish the two buffers merged

  • [in] src1: : first range to merge in a separate memory

  • [in] src2: : second range to merge, in the final part of the range where deposit the final results

  • [in] comp: : object for compare two elements of the type pointed by the Iter1 and Iter2

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Iter3, typename Sent3, typename Compare>
bool in_place_merge_uncontiguous(range<Iter1, Sent1> const &src1, range<Iter2, Sent2> const &src2, range<Iter3, Sent3> &aux, Compare comp)

: merge two non contiguous buffers src1 , src2, using the range aux as auxiliary memory

Parameters
  • [in] src1: : first range to merge

  • [in] src2: : second range to merge

  • [in] aux: : auxiliary range used in the merge

  • [in] comp: : object for to compare elements

Exceptions

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Compare>
range<Iter1, Sent1> in_place_merge(range<Iter1, Sent1> const &src1, range<Iter1, Sent1> const &src2, range<Iter2, Sent2> &buf, Compare comp)

: merge two contiguous buffers ( src1, src2) using buf as auxiliary memory

Parameters
  • [in] src1: : first range to merge

  • [in] src1: : second range to merge

  • [in] buf: : auxiliary memory used in the merge

  • [in] comp: : object for to compare elements

Exceptions

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Compare>
void merge_flow(range<Iter1, Sent1> rng1, range<Iter2, Sent2> rbuf, range<Iter1, Sent1> rng2, Compare cmp)

: merge two contiguous buffers

Template Parameters
  • Iter: : iterator to the elements

  • compare: : object for to compare two elements pointed by Iter iterators

Parameters
  • [in] first: : iterator to the first element

  • [in] last: : iterator to the element after the last in the range

  • [in] comp: : object for to compare elements

Exceptions