[libcxx-commits] [PATCH] D104492: [libc++][pstl] Implement tag dispatching

Thomas Rodgers via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 2 10:04:38 PDT 2021


rodgert accepted this revision.
rodgert added inline comments.


================
Comment at: pstl/include/pstl/internal/execution_impl.h:38-41
+template <typename... _IteratorTypes>
+struct __is_random_access_iterator : decltype(__is_iterator_of<std::random_access_iterator_tag, _IteratorTypes...>(0))
+{
+};
----------------
Quuxplusone wrote:
> Could this be:
> ```
> template <typename... _IteratorTypes>
> using __are_random_access_iterators = decltype(__internal::__is_iterator_of<
>     std::random_access_iterator_tag, _IteratorTypes...>(0));
> ```
> (Notice the ADL-proofing on `__is_iterator_of`.)
> 
> IIUC, the intent is that `__are_random_access_iterators<int*, char*>` is `true_type` but `__are_random_access_iterators<int*, std::list<int>::iterator>` is `false_type`, right?
> 
> Or if C++17 is permitted, then
> ```
> template <typename... _IteratorTypes>
> using __are_random_access_iterators = std::bool_constant<
>     (std::is_base_of_v<std::random_access_iterator_tag,
>                        typename std::iterator_traits<_IteratorTypes>::iterator_category> && ...)
> >;
> ```
At least as it relates to libstdc++'s consumption of pstl, C++17 is the baseline expectation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104492/new/

https://reviews.llvm.org/D104492



More information about the libcxx-commits mailing list