parallel_radixsort 函数

在一个指定大小的元素的 " 使用降序排序算法基数。 这是一个稳定排序需要一个射影函数可能项目元素分类为无符号 (如 Integer 键的函数。 默认初始化对于排序的元素是必需的。

template<
   typename _Random_iterator
>
inline void parallel_radixsort(
   const _Random_iterator &_Begin,
   const _Random_iterator &_End
);

template<
   typename _Allocator,
   typename _Random_iterator
>
inline void parallel_radixsort(
   const _Random_iterator &_Begin,
   const _Random_iterator &_End
);

template<
   typename _Allocator,
   typename _Random_iterator
>
inline void parallel_radixsort(
   const _Allocator& _Alloc,
   const _Random_iterator &_Begin,
   const _Random_iterator &_End
);

template<
   typename _Random_iterator,
   typename _Function
>
inline void parallel_radixsort(
   const _Random_iterator &_Begin,
   const _Random_iterator &_End,
   const _Function &_Proj_func,
   const size_t _Chunk_size = 256 * 256
);

template<
   typename _Allocator,
   typename _Random_iterator,
   typename _Function
>
inline void parallel_radixsort(
   const _Random_iterator &_Begin,
   const _Random_iterator &_End,
   const _Function &_Proj_func,
   const size_t _Chunk_size = 256 * 256
);

template<
   typename _Allocator,
   typename _Random_iterator,
   typename _Function
>
inline void parallel_radixsort(
   const _Allocator& _Alloc,
   const _Random_iterator &_Begin,
   const _Random_iterator &_End,
   const _Function &_Proj_func,
   const size_t _Chunk_size = 256 * 256
);

参数

  • _Random_iterator
    输入范围的迭代器类型。

  • _Allocator
    STL 兼容性内存分配器的类型。

  • _Function
    射影函数的类型。

  • _Begin
    解决一个随机访问迭代器第一个元素的位置在进行排序的大小。

  • _End
    解决一个随机访问迭代器通过最终元素的位置一在进行排序的大小。

  • _Alloc
    STL 兼容性内存分配器的实例。

  • _Proj_func
    将元素转换成一个整数值的用户定义的射影函数对象。

  • _Chunk_size
    将拆分为两个并行执行的区块的 mimimum 范围。

备注

所有重载需要 n * sizeof(T) 额外的空间, n 是排序的元素数,因此, T 是元素类型。 需要使用该签名I _Proj_func(T) 的一元 " 投影 functor 返回键,同时使元素, T 是元素类型,并 I 是无符号 (如 Integer 的类型。

如果您没有提供一个射影函数,返回元素的默认射影函数可用于整数类型。 ,如果元素不是整型在不射影函数时,函数无法编译。

如果您没有提供分配器类型或实例, STL 内存分配器 std::allocator<T> 用于分配缓冲区。

算法将输入范围划分为两个区块和并行连续将每个区块为执行的两个子区块。 可选参数 _Chunk_size 可用于指示到算法它按顺序应范围 < _Chunk_size 处理块。

要求

**标头:**ppl.h

命名空间: 并发

请参见

参考

concurrency 命名空间