Custom iterator works with std::sort but not with tbb::parallel_sort?

前端 未结 4 665
日久生厌
日久生厌 2021-02-15 18:13

I am trying to use tbb::parallel_sort to sort 2 arrays at the same time. Intel\'s documentation here says https://software.intel.com/en-us/node/506167 The req

4条回答
  •  伪装坚强ぢ
    2021-02-15 18:51

    The first error reads "no appropriate default constructor available..", but Iterators must be default constructible.

    Whether the default construction is used in one algorithm or another doesn't matter, the requirement still holds. So compilation success with std::sort and failure with tbb::parallel_sort doesn't mean the The requirements on the iterator and sequence are the same as for std::sort isn't true; it just means that the implementation of std::sort that you are using doesn't rely on that pre-requisite.

    If you implement your iterator to conform to the subset of standard that is relied upon by both algorithms, then it should work, per the documentation.

提交回复
热议问题