oneDPL icon indicating copy to clipboard operation
oneDPL copied to clipboard

[oneDPL] Added support C++ functor/lambda for permutation_iterator

Open MikeDvorskiy opened this issue 2 years ago • 1 comments

[oneDPL] permutation_iterator and permutation_view improvements

  1. Added support usage case like in Boost (https://www.boost.org/doc/libs/1_38_0/libs/iterator/doc/permutation_iterator.html)
  2. Aded support C++ functor as an index map for permutation_iterator (https://oneapi-src.github.io/oneDPL/parallel_api/iterators.html).
  3. Added support C++ functor as an index map for permutation_view
  4. The test coverage was extended as well.

MikeDvorskiy avatar Jul 21 '22 16:07 MikeDvorskiy

Am I right, that with your fix example from https://www.boost.org/doc/libs/1_66_0/libs/iterator/doc/html/iterator/specialized/permutation.html example will work OK and each of loops like std::copy( indices.begin(), indices.end(), std::ostream_iterator< int >( std::cout, " " ) ); will print all valued from container?

SergeyKopienko avatar Jul 28 '22 19:07 SergeyKopienko

While I missed this PR before, in fact it introduces a breaking change. Before, a map "functor" needed to provide an indexing operator[], while now a function call operator() is needed. As far as I understand, the issue exists even in the specification (which shows an example with operator[]).

So this is one more thing that might need to be noticed on the "breaking changes" page. And I wonder what we should do with the specification...

akukanov avatar Dec 07 '22 19:12 akukanov