diff --git a/pstl/include/pstl/internal/execution_impl.h b/pstl/include/pstl/internal/execution_impl.h --- a/pstl/include/pstl/internal/execution_impl.h +++ b/pstl/include/pstl/internal/execution_impl.h @@ -25,50 +25,13 @@ using namespace __pstl::execution; -/* predicate */ - -template -std::false_type __lazy_and(_Tp, std::false_type) -{ - return std::false_type{}; -} - -template -inline _Tp -__lazy_and(_Tp __a, std::true_type) -{ - return __a; -} - -template -std::true_type __lazy_or(_Tp, std::true_type) -{ - return std::true_type{}; -} - -template -inline _Tp -__lazy_or(_Tp __a, std::false_type) -{ - return __a; -} - -/* iterator */ -template -struct __is_random_access_iterator -{ - static constexpr bool value = __internal::__is_random_access_iterator<_IteratorType>::value && - __internal::__is_random_access_iterator<_OtherIteratorTypes...>::value; - typedef std::integral_constant type; -}; - template -struct __is_random_access_iterator<_IteratorType> - : std::is_same::iterator_category, std::random_access_iterator_tag> +struct __is_random_access_iterator + : std::is_same::iterator_category, + std::random_access_iterator_tag> { }; -/* policy */ template struct __policy_traits { @@ -77,39 +40,35 @@ template <> struct __policy_traits { - typedef std::false_type allow_parallel; - typedef std::false_type allow_unsequenced; - typedef std::false_type allow_vector; + typedef std::false_type __allow_parallel; + typedef std::false_type __allow_unsequenced; + typedef std::false_type __allow_vector; }; template <> struct __policy_traits { - typedef std::false_type allow_parallel; - typedef std::true_type allow_unsequenced; - typedef std::true_type allow_vector; + typedef std::false_type __allow_parallel; + typedef std::true_type __allow_unsequenced; + typedef std::true_type __allow_vector; }; template <> struct __policy_traits { - typedef std::true_type allow_parallel; - typedef std::false_type allow_unsequenced; - typedef std::false_type allow_vector; + typedef std::true_type __allow_parallel; + typedef std::false_type __allow_unsequenced; + typedef std::false_type __allow_vector; }; template <> struct __policy_traits { - typedef std::true_type allow_parallel; - typedef std::true_type allow_unsequenced; - typedef std::true_type allow_vector; + typedef std::true_type __allow_parallel; + typedef std::true_type __allow_unsequenced; + typedef std::true_type __allow_vector; }; -template -using __collector_t = - typename __internal::__policy_traits::type>::__collector_type; - template using __allow_vector = typename __internal::__policy_traits::type>::__allow_vector; @@ -123,41 +82,21 @@ typename __internal::__policy_traits::type>::__allow_parallel; template -auto +typename std::conjunction<__allow_vector<_ExecutionPolicy>, + __is_random_access_iterator<_IteratorTypes>...>::type __is_vectorization_preferred(_ExecutionPolicy&& __exec) - -> decltype(__internal::__lazy_and(__exec.__allow_vector(), - typename __internal::__is_random_access_iterator<_IteratorTypes...>::type())) { - return __internal::__lazy_and(__exec.__allow_vector(), - typename __internal::__is_random_access_iterator<_IteratorTypes...>::type()); + return {}; } template -auto +typename std::conjunction<__allow_parallel<_ExecutionPolicy>, + __is_random_access_iterator<_IteratorTypes>...>::type __is_parallelization_preferred(_ExecutionPolicy&& __exec) - -> decltype(__internal::__lazy_and(__exec.__allow_parallel(), - typename __internal::__is_random_access_iterator<_IteratorTypes...>::type())) { - return __internal::__lazy_and(__exec.__allow_parallel(), - typename __internal::__is_random_access_iterator<_IteratorTypes...>::type()); + return {}; } -template -struct __prefer_unsequenced_tag -{ - static constexpr bool value = __internal::__allow_unsequenced::value && - __internal::__is_random_access_iterator<_IteratorTypes...>::value; - typedef std::integral_constant type; -}; - -template -struct __prefer_parallel_tag -{ - static constexpr bool value = __internal::__allow_parallel::value && - __internal::__is_random_access_iterator<_IteratorTypes...>::value; - typedef std::integral_constant type; -}; - } // namespace __internal } // namespace __pstl