Synchronize libstdc++ PSTL with upstream LLVM PSTL
[gcc.git] / libstdc++-v3 / include / pstl / algorithm_impl.h
index 511e688c3f6c2c1b745dd39c9ad178f75e609fd3..0a78b33f2a0b62532233ab1c5e2782ce3446aebf 100644 (file)
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __PSTL_algorithm_impl_H
-#define __PSTL_algorithm_impl_H
+#ifndef _PSTL_ALGORITHM_IMPL_H
+#define _PSTL_ALGORITHM_IMPL_H
 
 #include <iterator>
 #include <type_traits>
 #include "execution_impl.h"
 #include "memory_impl.h"
 #include "parallel_backend_utils.h"
-#include "unseq_backend_simd.h"
-
-#if __PSTL_USE_PAR_POLICIES
 #include "parallel_backend.h"
 #include "parallel_impl.h"
-#endif
+#include "unseq_backend_simd.h"
+
 
 namespace __pstl
 {
@@ -59,20 +57,18 @@ __pattern_any_of(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
     return __internal::__brick_any_of(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Pred, class _IsVector>
 bool
 __pattern_any_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred,
                  _IsVector __is_vector, /*parallel=*/std::true_type)
 {
     return __internal::__except_handler([&]() {
-       return __internal::__parallel_or(std::forward<_ExecutionPolicy>(__exec), __first, __last,
-                             [__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                                 return __internal::__brick_any_of(__i, __j, __pred, __is_vector);
-                             });
+        return __internal::__parallel_or(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+                                         [__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
+                                             return __internal::__brick_any_of(__i, __j, __pred, __is_vector);
+                                         });
     });
 }
-#endif
 
 // [alg.foreach]
 // for_each_n with no policy
@@ -115,7 +111,6 @@ __pattern_walk1(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator _
     __internal::__brick_walk1(__first, __last, __f, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Function, class _IsVector>
 void
 __pattern_walk1(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Function __f,
@@ -129,7 +124,6 @@ __pattern_walk1(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
                                       });
     });
 }
-#endif
 
 template <class _ExecutionPolicy, class _ForwardIterator, class _Brick>
 void
@@ -139,7 +133,6 @@ __pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardItera
     __brick(__first, __last);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Brick>
 void
 __pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Brick __brick,
@@ -150,7 +143,6 @@ __pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwa
                                       [__brick](_ForwardIterator __i, _ForwardIterator __j) { __brick(__i, __j); });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // walk1_n
@@ -160,7 +152,7 @@ _ForwardIterator
 __brick_walk1_n(_ForwardIterator __first, _Size __n, _Function __f, /*_IsVectorTag=*/std::false_type)
 {
     return __internal::__for_each_n_it_serial(__first, __n,
-                                  [&__f](_ForwardIterator __it) { __f(*__it); }); // calling serial version
+                                              [&__f](_ForwardIterator __it) { __f(*__it); }); // calling serial version
 }
 
 template <class _RandomAccessIterator, class _DifferenceType, class _Function>
@@ -179,17 +171,16 @@ __pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator __first, _Size __n, _Func
     return __internal::__brick_walk1_n(__first, __n, __f, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Function, class _IsVector>
 _RandomAccessIterator
 __pattern_walk1_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Function __f,
                   _IsVector __is_vector,
                   /*is_parallel=*/std::true_type)
 {
-    __internal::__pattern_walk1(std::forward<_ExecutionPolicy>(__exec), __first, __first + __n, __f, __is_vector, std::true_type());
+    __internal::__pattern_walk1(std::forward<_ExecutionPolicy>(__exec), __first, __first + __n, __f, __is_vector,
+                                std::true_type());
     return __first + __n;
 }
-#endif
 
 template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Brick>
 _ForwardIterator
@@ -199,7 +190,6 @@ __pattern_walk_brick_n(_ExecutionPolicy&&, _ForwardIterator __first, _Size __n,
     return __brick(__first, __n);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Brick>
 _RandomAccessIterator
 __pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Brick __brick,
@@ -212,7 +202,6 @@ __pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
         return __first + __n;
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // walk2 (pseudo)
@@ -263,7 +252,6 @@ __pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator
     return __internal::__brick_walk2(__first1, __last1, __first2, __f, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Function, class _IsVector>
 _ForwardIterator2
 __pattern_walk2(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
@@ -278,15 +266,14 @@ __pattern_walk2(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardI
         return __first2 + (__last1 - __first1);
     });
 }
-#endif
 
 template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Function,
           class _IsVector>
 _ForwardIterator2
 __pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Size __n, _ForwardIterator2 __first2, _Function __f,
-                  _IsVector is_vector, /*parallel=*/std::false_type) noexcept
+                  _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __internal::__brick_walk2_n(__first1, __n, __first2, __f, is_vector);
+    return __internal::__brick_walk2_n(__first1, __n, __first2, __f, __is_vector);
 }
 
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2,
@@ -307,7 +294,6 @@ __pattern_walk2_brick(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIt
     return __brick(__first1, __last1, __first2);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Brick>
 _RandomAccessIterator2
 __pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
@@ -322,9 +308,7 @@ __pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1
         return __first2 + (__last1 - __first1);
     });
 }
-#endif
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2, class _Brick>
 _RandomAccessIterator2
 __pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size __n,
@@ -339,7 +323,6 @@ __pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __firs
         return __first2 + __n;
     });
 }
-#endif
 
 template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Brick>
 _ForwardIterator2
@@ -381,7 +364,6 @@ __pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator
     return __internal::__brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2,
           class _RandomAccessIterator3, class _Function, class _IsVector>
 _RandomAccessIterator3
@@ -393,12 +375,12 @@ __pattern_walk3(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
         __par_backend::__parallel_for(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
             [__f, __first1, __first2, __first3, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
-                __internal::__brick_walk3(__i, __j, __first2 + (__i - __first1), __first3 + (__i - __first1), __f, __is_vector);
+                __internal::__brick_walk3(__i, __j, __first2 + (__i - __first1), __first3 + (__i - __first1), __f,
+                                          __is_vector);
             });
         return __first3 + (__last1 - __first1);
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // equal
@@ -435,7 +417,6 @@ __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator
     return __internal::__brick_equal(__first1, __last1, __first2, __last2, __p, __is_vector);
 }
 
-#if _PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate,
           class _IsVector>
 bool
@@ -455,7 +436,6 @@ __pattern_equal(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
             });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // equal version for sequences with equal length
@@ -487,7 +467,6 @@ __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator
     return __internal::__brick_equal(__first1, __last1, __first2, __p, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate,
           class _IsVector>
 bool
@@ -503,7 +482,6 @@ __pattern_equal(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
             });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // find_if
@@ -536,7 +514,6 @@ __pattern_find_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
     return __internal::__brick_find_if(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector>
 _ForwardIterator
 __pattern_find_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
@@ -544,15 +521,15 @@ __pattern_find_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
                   /*is_parallel=*/std::true_type)
 {
     return __internal::__except_handler([&]() {
-                       return __internal::__parallel_find(std::forward<_ExecutionPolicy>(__exec), __first, __last,
-                               [__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                                   return __internal::__brick_find_if(__i, __j, __pred, __is_vector);
-                               },
-                               std::less<typename std::iterator_traits<_ForwardIterator>::difference_type>(),
-                               /*is_first=*/true);
+        return __internal::__parallel_find(
+            std::forward<_ExecutionPolicy>(__exec), __first, __last,
+            [__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
+                return __internal::__brick_find_if(__i, __j, __pred, __is_vector);
+            },
+            std::less<typename std::iterator_traits<_ForwardIterator>::difference_type>(),
+            /*is_first=*/true);
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // find_end
@@ -584,8 +561,8 @@ __find_subrange(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _
     while (__first != __last && (__global_last - __first >= __n2))
     {
         // find position of *s_first in [first, last) (it can be start of subsequence)
-        __first = __internal::__brick_find_if(__first, __last,
-                                  __equal_value_by_pred<_ValueType, _BinaryPredicate>(*__s_first, __pred), __is_vector);
+        __first = __internal::__brick_find_if(
+            __first, __last, __equal_value_by_pred<_ValueType, _BinaryPredicate>(*__s_first, __pred), __is_vector);
 
         // if position that was found previously is the start of subsequence
         // then we can exit the loop (b_first == true) or keep the position
@@ -635,8 +612,8 @@ __find_subrange(_RandomAccessIterator __first, _RandomAccessIterator __last, _Ra
 
         // check that all of elements in [first+1, first+count) equal to value
         if (__first != __last && (__global_last - __first >= __count) &&
-            !__internal::__brick_any_of(__first + 1, __first + __count, __not_pred<decltype(__unary_pred)>(__unary_pred),
-                            __is_vector))
+            !__internal::__brick_any_of(__first + 1, __first + __count,
+                                        __not_pred<decltype(__unary_pred)>(__unary_pred), __is_vector))
         {
             return __first;
         }
@@ -678,7 +655,6 @@ __pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardIterat
     return __internal::__brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
           class _IsVector>
 _ForwardIterator1
@@ -688,23 +664,23 @@ __pattern_find_end(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _Forwar
 {
     if (__last - __first == __s_last - __s_first)
     {
-        const bool __res = __internal::__pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
-                                           __is_vector, std::true_type());
+        const bool __res = __internal::__pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+                                                       __s_first, __pred, __is_vector, std::true_type());
         return __res ? __first : __last;
     }
     else
     {
         return __internal::__except_handler([&]() {
-           return __internal::__parallel_find(
+            return __internal::__parallel_find(
                 std::forward<_ExecutionPolicy>(__exec), __first, __last,
                 [__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                    return __internal::__find_subrange(__i, __j, __last, __s_first, __s_last, __pred, false, __is_vector);
+                    return __internal::__find_subrange(__i, __j, __last, __s_first, __s_last, __pred, false,
+                                                       __is_vector);
                 },
                 std::greater<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/false);
         });
     }
 }
-#endif
 
 //------------------------------------------------------------------------
 // find_first_of
@@ -735,7 +711,6 @@ __pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardI
     return __internal::__brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
           class _IsVector>
 _ForwardIterator1
@@ -744,7 +719,7 @@ __pattern_find_first_of(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _F
                         _IsVector __is_vector, /*is_parallel=*/std::true_type) noexcept
 {
     return __internal::__except_handler([&]() {
-         return __internal::__parallel_find(
+        return __internal::__parallel_find(
             std::forward<_ExecutionPolicy>(__exec), __first, __last,
             [__s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
                 return __internal::__brick_find_first_of(__i, __j, __s_first, __s_last, __pred, __is_vector);
@@ -752,7 +727,6 @@ __pattern_find_first_of(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _F
             std::less<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/true);
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // search
@@ -783,7 +757,6 @@ __pattern_search(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardIterator
     return __internal::__brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
           class _IsVector>
 _ForwardIterator1
@@ -794,8 +767,8 @@ __pattern_search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardI
 {
     if (__last - __first == __s_last - __s_first)
     {
-        const bool __res = __internal::__pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
-                                           __is_vector, std::true_type());
+        const bool __res = __internal::__pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+                                                       __s_first, __pred, __is_vector, std::true_type());
         return __res ? __first : __last;
     }
     else
@@ -804,13 +777,13 @@ __pattern_search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardI
             return __internal::__parallel_find(
                 std::forward<_ExecutionPolicy>(__exec), __first, __last,
                 [__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                    return __internal::__find_subrange(__i, __j, __last, __s_first, __s_last, __pred, true, __is_vector);
+                    return __internal::__find_subrange(__i, __j, __last, __s_first, __s_last, __pred, true,
+                                                       __is_vector);
                 },
                 std::less<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/true);
         });
     }
 }
-#endif
 
 //------------------------------------------------------------------------
 // search_n
@@ -841,7 +814,6 @@ __pattern_search_n(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterato
     return __internal::__brick_search_n(__first, __last, __count, __value, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Tp, class _BinaryPredicate,
           class _IsVector>
 _RandomAccessIterator
@@ -851,10 +823,10 @@ __pattern_search_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ra
 {
     if (__last - __first == __count)
     {
-        const bool __result =
-            !__internal::__pattern_any_of(std::forward<_ExecutionPolicy>(__exec), __first, __last,
-                              [&__value, &__pred](const _Tp& __val) { return !__pred(__val, __value); }, __is_vector,
-                              /*is_parallel*/ std::true_type());
+        const bool __result = !__internal::__pattern_any_of(
+            std::forward<_ExecutionPolicy>(__exec), __first, __last,
+            [&__value, &__pred](const _Tp& __val) { return !__pred(__val, __value); }, __is_vector,
+            /*is_parallel*/ std::true_type());
         return __result ? __first : __last;
     }
     else
@@ -869,7 +841,6 @@ __pattern_search_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ra
         });
     }
 }
-#endif
 
 //------------------------------------------------------------------------
 // copy_n
@@ -969,7 +940,7 @@ _OutputIterator
 __brick_copy_if(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, _UnaryPredicate __pred,
                 /*vector=*/std::true_type) noexcept
 {
-#if (__PSTL_MONOTONIC_PRESENT)
+#if (_PSTL_MONOTONIC_PRESENT)
     return __unseq_backend::__simd_copy_if(__first, __last - __first, __result, __pred);
 #else
     return std::copy_if(__first, __last, __result, __pred);
@@ -1028,7 +999,7 @@ void
 __brick_copy_by_mask(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
                      bool* __restrict __mask, _Assigner __assigner, /*vector=*/std::true_type) noexcept
 {
-#if (__PSTL_MONOTONIC_PRESENT)
+#if (_PSTL_MONOTONIC_PRESENT)
     __unseq_backend::__simd_copy_by_mask(__first, __last - __first, __result, __mask, __assigner);
 #else
     __internal::__brick_copy_by_mask(__first, __last, __result, __mask, __assigner, std::false_type());
@@ -1060,7 +1031,7 @@ void
 __brick_partition_by_mask(_RandomAccessIterator __first, _RandomAccessIterator __last, _OutputIterator1 __out_true,
                           _OutputIterator2 __out_false, bool* __mask, /*vector=*/std::true_type) noexcept
 {
-#if (__PSTL_MONOTONIC_PRESENT)
+#if (_PSTL_MONOTONIC_PRESENT)
     __unseq_backend::__simd_partition_by_mask(__first, __last - __first, __out_true, __out_false, __mask);
 #else
     __internal::__brick_partition_by_mask(__first, __last, __out_true, __out_false, __mask, std::false_type());
@@ -1075,7 +1046,6 @@ __pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
     return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _UnaryPredicate,
           class _IsVector>
 _OutputIterator
@@ -1093,15 +1063,15 @@ __pattern_copy_if(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ran
             __par_backend::__parallel_strict_scan(
                 std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
                 [=](_DifferenceType __i, _DifferenceType __len) { // Reduce
-                    return __internal::__brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
-                                                                __pred, __is_vector)
+                    return __internal::__brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len),
+                                                                            __mask + __i, __pred, __is_vector)
                         .first;
                 },
                 std::plus<_DifferenceType>(),                                                // Combine
                 [=](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) { // Scan
-                    __internal::__brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
-                                         [](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; },
-                                         __is_vector);
+                    __internal::__brick_copy_by_mask(
+                        __first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
+                        [](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; }, __is_vector);
                 },
                 [&__m](_DifferenceType __total) { __m = __total; });
             return __result + __m;
@@ -1110,7 +1080,6 @@ __pattern_copy_if(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ran
     // trivial sequence - use serial algorithm
     return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // count
@@ -1139,7 +1108,6 @@ __pattern_count(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator _
     return __internal::__brick_count(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector>
 typename std::iterator_traits<_ForwardIterator>::difference_type
 __pattern_count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
@@ -1155,7 +1123,6 @@ __pattern_count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
             std::plus<_SizeType>());
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // unique
@@ -1174,7 +1141,7 @@ _ForwardIterator
 __brick_unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred,
                /*is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::unique(__first, __last, __pred);
 }
 
@@ -1186,13 +1153,12 @@ __pattern_unique(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
     return __internal::__brick_unique(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 // That function is shared between two algorithms - remove_if (__pattern_remove_if) and unique (pattern unique). But a mask calculation is different.
 // So, a caller passes _CalcMask brick into remove_elements.
 template <class _ExecutionPolicy, class _ForwardIterator, class _CalcMask, class _IsVector>
 _ForwardIterator
 __remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _CalcMask __calc_mask,
-                _IsVector __is_vector)
+                  _IsVector __is_vector)
 {
     typedef typename std::iterator_traits<_ForwardIterator>::difference_type _DifferenceType;
     typedef typename std::iterator_traits<_ForwardIterator>::value_type _Tp;
@@ -1214,8 +1180,8 @@ __remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
                     return __local_min;
                 }
                 // find first iterator that should be removed
-                bool* __result =
-                    __internal::__brick_find_if(__mask + __i, __mask + __j, [](bool __val) { return !__val; }, __is_vector);
+                bool* __result = __internal::__brick_find_if(__mask + __i, __mask + __j,
+                                                             [](bool __val) { return !__val; }, __is_vector);
                 if (__result - __mask == __j)
                 {
                     return __local_min;
@@ -1242,16 +1208,18 @@ __remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
         __par_backend::__parallel_strict_scan(
             std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
             [__mask, __is_vector](_DifferenceType __i, _DifferenceType __len) {
-                return __internal::__brick_count(__mask + __i, __mask + __i + __len, [](bool __val) { return __val; }, __is_vector);
+                return __internal::__brick_count(__mask + __i, __mask + __i + __len, [](bool __val) { return __val; },
+                                                 __is_vector);
             },
             std::plus<_DifferenceType>(),
             [=](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) {
-                __internal::__brick_copy_by_mask(__first + __i, __first + __i + __len, __result + __initial, __mask + __i,
-                                     [](_ForwardIterator __x, _Tp* __z) {
-                                         __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
-                                                          [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
-                                     },
-                                     __is_vector);
+                __internal::__brick_copy_by_mask(
+                    __first + __i, __first + __i + __len, __result + __initial, __mask + __i,
+                    [](_ForwardIterator __x, _Tp* __z) {
+                        __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
+                                                     [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
+                    },
+                    __is_vector);
             },
             [&__m](_DifferenceType __total) { __m = __total; });
 
@@ -1263,9 +1231,7 @@ __remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
         return __first + __m;
     });
 }
-#endif
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate, class _IsVector>
 _ForwardIterator
 __pattern_unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred,
@@ -1285,13 +1251,12 @@ __pattern_unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt
     return __internal::__remove_elements(
         std::forward<_ExecutionPolicy>(__exec), ++__first, __last,
         [&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
-            __internal::__brick_walk3(__b, __e, __it - 1, __it,
-                          [&__pred](bool& __x, _ReferenceType __y, _ReferenceType __z) { __x = !__pred(__y, __z); },
-                          __is_vector);
+            __internal::__brick_walk3(
+                __b, __e, __it - 1, __it,
+                [&__pred](bool& __x, _ReferenceType __y, _ReferenceType __z) { __x = !__pred(__y, __z); }, __is_vector);
         },
         __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // unique_copy
@@ -1310,7 +1275,7 @@ OutputIterator
 __brick_unique_copy(_RandomAccessIterator __first, _RandomAccessIterator __last, OutputIterator __result,
                     _BinaryPredicate __pred, /*vector=*/std::true_type) noexcept
 {
-#if (__PSTL_MONOTONIC_PRESENT)
+#if (_PSTL_MONOTONIC_PRESENT)
     return __unseq_backend::__simd_unique_copy(__first, __last - __first, __result, __pred);
 #else
     return std::unique_copy(__first, __last, __result, __pred);
@@ -1348,7 +1313,6 @@ __brick_calc_mask_2(_RandomAccessIterator __first, _RandomAccessIterator __last,
     return __unseq_backend::__simd_calc_mask_2(__first, __last - __first, __mask, __pred);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _BinaryPredicate,
           class _IsVector>
 _OutputIterator
@@ -1380,15 +1344,15 @@ __pattern_unique_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
                             ++__extra;
                         }
                         return __internal::__brick_calc_mask_2<_DifferenceType>(__first + __i, __first + (__i + __len),
-                                                                    __mask + __i, __pred, __is_vector) +
+                                                                                __mask + __i, __pred, __is_vector) +
                                __extra;
                     },
                     std::plus<_DifferenceType>(),                                                // Combine
                     [=](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) { // Scan
                         // Phase 2 is same as for __pattern_copy_if
-                        __internal::__brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
-                                             [](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; },
-                                             __is_vector);
+                        __internal::__brick_copy_by_mask(
+                            __first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
+                            [](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; }, __is_vector);
                     },
                     [&__m](_DifferenceType __total) { __m = __total; });
                 return __result + __m;
@@ -1398,7 +1362,6 @@ __pattern_unique_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
     // trivial sequence - use serial algorithm
     return __internal::__brick_unique_copy(__first, __last, __result, __pred, __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // reverse
@@ -1461,7 +1424,6 @@ __pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bidirecti
     __internal::__brick_reverse(__first, __last, _is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _BidirectionalIterator, class _IsVector>
 void
 __pattern_reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last,
@@ -1473,7 +1435,6 @@ __pattern_reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _Bi
             __internal::__brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector);
         });
 }
-#endif
 
 //------------------------------------------------------------------------
 // reverse_copy
@@ -1507,7 +1468,6 @@ __pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bidi
     return __internal::__brick_reverse_copy(__first, __last, __d_first, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _BidirectionalIterator, class _OutputIterator, class _IsVector>
 _OutputIterator
 __pattern_reverse_copy(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last,
@@ -1518,11 +1478,11 @@ __pattern_reverse_copy(_ExecutionPolicy&& __exec, _BidirectionalIterator __first
                                   [__is_vector, __first, __len, __d_first](_BidirectionalIterator __inner_first,
                                                                            _BidirectionalIterator __inner_last) {
                                       __internal::__brick_reverse_copy(__inner_first, __inner_last,
-                                                           __d_first + (__len - (__inner_last - __first)), __is_vector);
+                                                                       __d_first + (__len - (__inner_last - __first)),
+                                                                       __is_vector);
                                   });
     return __d_first + __len;
 }
-#endif
 
 //------------------------------------------------------------------------
 // rotate
@@ -1532,7 +1492,7 @@ _ForwardIterator
 __brick_rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
                /*is_vector=*/std::false_type) noexcept
 {
-#if __PSTL_CPP11_STD_ROTATE_BROKEN
+#if _PSTL_CPP11_STD_ROTATE_BROKEN
     std::rotate(__first, __middle, __last);
     return std::next(__first, std::distance(__middle, __last));
 #else
@@ -1589,7 +1549,6 @@ __pattern_rotate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
     return __internal::__brick_rotate(__first, __middle, __last, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _IsVector>
 _ForwardIterator
 __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle,
@@ -1611,12 +1570,14 @@ __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt
 
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __middle,
                                           [__last, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
-                                              __internal::__brick_move(__b, __e, __b + (__last - __middle), __is_vector);
+                                              __internal::__brick_move(__b, __e, __b + (__last - __middle),
+                                                                       __is_vector);
                                           });
 
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __result, __result + (__n - __m),
                                           [__first, __result, __is_vector](_Tp* __b, _Tp* __e) {
-                                              __internal::__brick_move(__b, __e, __first + (__b - __result), __is_vector);
+                                              __internal::__brick_move(__b, __e, __first + (__b - __result),
+                                                                       __is_vector);
                                           });
 
             return __first + (__last - __middle);
@@ -1629,26 +1590,26 @@ __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt
             _Tp* __result = __buf.get();
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __middle,
                                           [__first, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
-                                              __internal::__brick_uninitialized_move(__b, __e, __result + (__b - __first),
-                                                                         __is_vector);
+                                              __internal::__brick_uninitialized_move(
+                                                  __b, __e, __result + (__b - __first), __is_vector);
                                           });
 
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __middle, __last,
                                           [__first, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
-                                              __internal::__brick_move(__b, __e, __first + (__b - __middle), __is_vector);
+                                              __internal::__brick_move(__b, __e, __first + (__b - __middle),
+                                                                       __is_vector);
                                           });
 
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __result, __result + __m,
                                           [__n, __m, __first, __result, __is_vector](_Tp* __b, _Tp* __e) {
-                                              __internal::__brick_move(__b, __e, __first + ((__n - __m) + (__b - __result)),
-                                                           __is_vector);
+                                              __internal::__brick_move(
+                                                  __b, __e, __first + ((__n - __m) + (__b - __result)), __is_vector);
                                           });
 
             return __first + (__last - __middle);
         });
     }
 }
-#endif
 
 //------------------------------------------------------------------------
 // rotate_copy
@@ -1679,7 +1640,6 @@ __pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIter
     return __internal::__brick_rotate_copy(__first, __middle, __last, __result, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _IsVector>
 _OutputIterator
 __pattern_rotate_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle,
@@ -1709,7 +1669,6 @@ __pattern_rotate_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forw
         });
     return __result + (__last - __first);
 }
-#endif
 
 //------------------------------------------------------------------------
 // is_partitioned
@@ -1758,7 +1717,6 @@ __pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI
     return __internal::__brick_is_partitioned(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
 bool
 __pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
@@ -1855,7 +1813,6 @@ __pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
         });
     }
 }
-#endif
 
 //------------------------------------------------------------------------
 // partition
@@ -1874,7 +1831,7 @@ _ForwardIterator
 __brick_partition(_ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
                   /*is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::partition(__first, __last, __pred);
 }
 
@@ -1886,7 +1843,6 @@ __pattern_partition(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterat
     return __internal::__brick_partition(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
 _ForwardIterator
 __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
@@ -1923,7 +1879,8 @@ __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
                 __par_backend::__parallel_for(
                     std::forward<_ExecutionPolicy>(__exec), __val1.__pivot, __val1.__pivot + __size1,
                     [__val1, __val2, __size1, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                        __internal::__brick_swap_ranges(__i, __j, (__val2.__pivot - __size1) + (__i - __val1.__pivot), __is_vector);
+                        __internal::__brick_swap_ranges(__i, __j, (__val2.__pivot - __size1) + (__i - __val1.__pivot),
+                                                        __is_vector);
                     });
                 return {__new_begin, __val2.__pivot - __size1, __val2.__end};
             }
@@ -1953,7 +1910,6 @@ __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
         return __result.__pivot;
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // stable_partition
@@ -1972,7 +1928,7 @@ _BidirectionalIterator
 __brick_stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _UnaryPredicate __pred,
                          /*__is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::stable_partition(__first, __last, __pred);
 }
 
@@ -1985,7 +1941,6 @@ __pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator __first, _
     return __internal::__brick_stable_partition(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _BidirectionalIterator, class _UnaryPredicate, class _IsVector>
 _BidirectionalIterator
 __pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last,
@@ -2037,7 +1992,6 @@ __pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __f
         return __result.__pivot;
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // partition_copy
@@ -2056,7 +2010,7 @@ std::pair<_OutputIterator1, _OutputIterator2>
 __brick_partition_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator1 __out_true,
                        _OutputIterator2 __out_false, _UnaryPredicate __pred, /*is_vector=*/std::true_type) noexcept
 {
-#if (__PSTL_MONOTONIC_PRESENT)
+#if (_PSTL_MONOTONIC_PRESENT)
     return __unseq_backend::__simd_partition_copy(__first, __last - __first, __out_true, __out_false, __pred);
 #else
     return std::partition_copy(__first, __last, __out_true, __out_false, __pred);
@@ -2073,7 +2027,6 @@ __pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI
     return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator1, class _OutputIterator2,
           class _UnaryPredicate, class _IsVector>
 std::pair<_OutputIterator1, _OutputIterator2>
@@ -2087,21 +2040,23 @@ __pattern_partition_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs
     if (_DifferenceType(1) < __n)
     {
         __par_backend::__buffer<bool> __mask_buf(__n);
-        return __internal::__except_handler([&__exec, __n, __first, __out_true, __out_false, __is_vector, __pred, &__mask_buf]() {
+        return __internal::__except_handler([&__exec, __n, __first, __out_true, __out_false, __is_vector, __pred,
+                                             &__mask_buf]() {
             bool* __mask = __mask_buf.get();
             _ReturnType __m{};
             __par_backend::__parallel_strict_scan(
                 std::forward<_ExecutionPolicy>(__exec), __n, std::make_pair(_DifferenceType(0), _DifferenceType(0)),
                 [=](_DifferenceType __i, _DifferenceType __len) { // Reduce
-                    return __internal::__brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
-                                                                __pred, __is_vector);
+                    return __internal::__brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len),
+                                                                            __mask + __i, __pred, __is_vector);
                 },
                 [](const _ReturnType& __x, const _ReturnType& __y) -> _ReturnType {
                     return std::make_pair(__x.first + __y.first, __x.second + __y.second);
                 },                                                                       // Combine
                 [=](_DifferenceType __i, _DifferenceType __len, _ReturnType __initial) { // Scan
-                    __internal::__brick_partition_by_mask(__first + __i, __first + (__i + __len), __out_true + __initial.first,
-                                              __out_false + __initial.second, __mask + __i, __is_vector);
+                    __internal::__brick_partition_by_mask(__first + __i, __first + (__i + __len),
+                                                          __out_true + __initial.first, __out_false + __initial.second,
+                                                          __mask + __i, __is_vector);
                 },
                 [&__m](_ReturnType __total) { __m = __total; });
             return std::make_pair(__out_true + __m.first, __out_false + __m.second);
@@ -2110,7 +2065,6 @@ __pattern_partition_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs
     // trivial sequence - use serial algorithm
     return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // sort
@@ -2125,7 +2079,6 @@ __pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _RandomAccessI
     std::sort(__first, __last, __comp);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
 void
 __pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
@@ -2138,7 +2091,6 @@ __pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Random
                                               __last - __first);
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // stable_sort
@@ -2152,7 +2104,6 @@ __pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _Random
     std::stable_sort(__first, __last, __comp);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
 void
 __pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last,
@@ -2164,7 +2115,6 @@ __pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
                                                  _Compare __comp) { std::stable_sort(__first, __last, __comp); });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // partial_sort
@@ -2179,7 +2129,6 @@ __pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _Rando
     std::partial_sort(__first, __middle, __last, __comp);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
 void
 __pattern_partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __middle,
@@ -2198,7 +2147,6 @@ __pattern_partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
             __n);
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // partial_sort_copy
@@ -2213,7 +2161,6 @@ __pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator __first, _Forwa
     return std::partial_sort_copy(__first, __last, __d_first, __d_last, __comp);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _RandomAccessIterator, class _Compare, class _IsVector>
 _RandomAccessIterator
 __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
@@ -2237,11 +2184,11 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first,
                     _ForwardIterator __j1 = __first + (__j - __d_first);
 
                 // 1. Copy elements from input to output
-#if !__PSTL_ICC_18_OMP_SIMD_BROKEN
+#    if !_PSTL_ICC_18_OMP_SIMD_BROKEN
                     __internal::__brick_copy(__i1, __j1, __i, __is_vector);
-#else
+#    else
                     std::copy(__i1, __j1, __i);
-#endif
+#    endif
                     // 2. Sort elements in output sequence
                     std::sort(__i, __j, __comp);
                 },
@@ -2282,7 +2229,6 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first,
         }
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // adjacent_find
@@ -2311,7 +2257,6 @@ __pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIt
     return __internal::__brick_adjacent_find(__first, __last, __pred, __is_vector, __or_semantic);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _BinaryPredicate, class _IsVector>
 _RandomAccessIterator
 __pattern_adjacent_find(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last,
@@ -2357,7 +2302,6 @@ __pattern_adjacent_find(_ExecutionPolicy&& __exec, _RandomAccessIterator __first
         );
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // nth_element
@@ -2372,7 +2316,6 @@ __pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator __first, _Random
     std::nth_element(__first, __nth, __last, __comp);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
 void
 __pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __nth,
@@ -2390,8 +2333,9 @@ __pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
     do
     {
         __x = __internal::__pattern_partition(std::forward<_ExecutionPolicy>(__exec), __first + 1, __last,
-                                  [&__comp, __first](const _Tp& __x) { return __comp(__x, *__first); }, __is_vector,
-                                  /*is_parallel=*/std::true_type());
+                                              [&__comp, __first](const _Tp& __x) { return __comp(__x, *__first); },
+                                              __is_vector,
+                                              /*is_parallel=*/std::true_type());
         --__x;
         if (__x != __first)
         {
@@ -2418,7 +2362,6 @@ __pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
         }
     } while (__x != __nth);
 }
-#endif
 
 //------------------------------------------------------------------------
 // fill, fill_n
@@ -2447,7 +2390,6 @@ __pattern_fill(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __
     __internal::__brick_fill(__first, __last, __value, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _IsVector>
 _ForwardIterator
 __pattern_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value,
@@ -2461,7 +2403,6 @@ __pattern_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIter
         return __last;
     });
 }
-#endif
 
 template <class _OutputIterator, class _Size, class _Tp>
 _OutputIterator
@@ -2490,8 +2431,8 @@ _OutputIterator
 __pattern_fill_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size __count, const _Tp& __value,
                  /*is_parallel=*/std::true_type, _IsVector __is_vector)
 {
-    return __internal::__pattern_fill(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __value, std::true_type(),
-                          __is_vector);
+    return __internal::__pattern_fill(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __value,
+                                      std::true_type(), __is_vector);
 }
 
 //------------------------------------------------------------------------
@@ -2521,7 +2462,6 @@ __pattern_generate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterato
     __internal::__brick_generate(__first, __last, __g, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _Generator, class _IsVector>
 _ForwardIterator
 __pattern_generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g,
@@ -2535,7 +2475,6 @@ __pattern_generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forward
         return __last;
     });
 }
-#endif
 
 template <class OutputIterator, class Size, class _Generator>
 OutputIterator
@@ -2559,7 +2498,6 @@ __pattern_generate_n(_ExecutionPolicy&&, _OutputIterator __first, _Size __count,
     return __internal::__brick_generate_n(__first, __count, __g, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _OutputIterator, class _Size, class _Generator, class _IsVector>
 _OutputIterator
 __pattern_generate_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size __count, _Generator __g,
@@ -2567,10 +2505,9 @@ __pattern_generate_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size _
 {
     static_assert(__is_random_access_iterator<_OutputIterator>::value,
                   "Pattern-brick error. Should be a random access iterator.");
-    return __internal::__pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(),
-                              __is_vector);
+    return __internal::__pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g,
+                                          std::true_type(), __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // remove
@@ -2589,7 +2526,7 @@ _RandomAccessIterator
 __brick_remove_if(_RandomAccessIterator __first, _RandomAccessIterator __last, _UnaryPredicate __pred,
                   /* __is_vector = */ std::true_type) noexcept
 {
-#if __PSTL_MONOTONIC_PRESENT
+#if _PSTL_MONOTONIC_PRESENT
     return __unseq_backend::__simd_remove_if(__first, __last - __first, __pred);
 #else
     return std::remove_if(__first, __last, __pred);
@@ -2604,7 +2541,6 @@ __pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterat
     return __internal::__brick_remove_if(__first, __last, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
 _ForwardIterator
 __pattern_remove_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
@@ -2618,15 +2554,14 @@ __pattern_remove_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
         return __internal::__brick_remove_if(__first, __last, __pred, __is_vector);
     }
 
-    return __internal::__remove_elements(std::forward<_ExecutionPolicy>(__exec), __first, __last,
-                           [&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
-                               __internal::__brick_walk2(__b, __e, __it,
-                                             [&__pred](bool& __x, _ReferenceType __y) { __x = !__pred(__y); },
-                                             __is_vector);
-                           },
-                           __is_vector);
+    return __internal::__remove_elements(
+        std::forward<_ExecutionPolicy>(__exec), __first, __last,
+        [&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
+            __internal::__brick_walk2(__b, __e, __it, [&__pred](bool& __x, _ReferenceType __y) { __x = !__pred(__y); },
+                                      __is_vector);
+        },
+        __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // merge
@@ -2647,7 +2582,7 @@ __brick_merge(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIte
               _ForwardIterator2 __last2, _OutputIterator __d_first, _Compare __comp,
               /* __is_vector = */ std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::merge(__first1, __last1, __first2, __last2, __d_first, __comp);
 }
 
@@ -2661,7 +2596,6 @@ __pattern_merge(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator
     return __internal::__brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator,
           class _Compare, class _IsVector>
 _OutputIterator
@@ -2672,11 +2606,11 @@ __pattern_merge(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
     __par_backend::__parallel_merge(
         std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __d_first, __comp,
         [__is_vector](_RandomAccessIterator1 __f1, _RandomAccessIterator1 __l1, _RandomAccessIterator2 __f2,
-                      _RandomAccessIterator2 __l2, _OutputIterator __f3,
-                      _Compare __comp) { return __internal::__brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector); });
+                      _RandomAccessIterator2 __l2, _OutputIterator __f3, _Compare __comp) {
+            return __internal::__brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector);
+        });
     return __d_first + (__last1 - __first1) + (__last2 - __first2);
 }
-#endif
 
 //------------------------------------------------------------------------
 // inplace_merge
@@ -2694,7 +2628,7 @@ void
 __brick_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
                       _Compare __comp, /* __is_vector = */ std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial")
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial")
     std::inplace_merge(__first, __middle, __last, __comp);
 }
 
@@ -2707,7 +2641,6 @@ __pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bid
     __internal::__brick_inplace_merge(__first, __middle, __last, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _BidirectionalIterator, class _Compare, class _IsVector>
 void
 __pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __middle,
@@ -2724,8 +2657,8 @@ __pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __firs
     _Tp* __r = __buf.get();
     __internal::__except_handler([&]() {
         auto __move_values = [](_BidirectionalIterator __x, _Tp* __z) {
-                                 __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
-                                                              [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
+            __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
+                                         [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
         };
 
         auto __move_sequences = [](_BidirectionalIterator __first1, _BidirectionalIterator __last1, _Tp* __first2) {
@@ -2749,7 +2682,6 @@ __pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __firs
                                       });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // includes
@@ -2764,7 +2696,6 @@ __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwa
     return std::includes(__first1, __last1, __first2, __last2, __comp);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector>
 bool
 __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
@@ -2785,11 +2716,11 @@ __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwa
         return !__comp(*__first1, *__first2) && !__comp(*__first2, *__first1);
 
     return __internal::__except_handler([&]() {
-         return !__internal::__parallel_or(
+        return !__internal::__parallel_or(
             std::forward<_ExecutionPolicy>(__exec), __first2, __last2,
             [__first1, __last1, __first2, __last2, &__comp](_ForwardIterator2 __i, _ForwardIterator2 __j) {
-                __PSTL_ASSERT(__j > __i);
-                //__PSTL_ASSERT(__j - __i > 1);
+                _PSTL_ASSERT(__j > __i);
+                //assert(__j - __i > 1);
 
                 //1. moving boundaries to "consume" subsequence of equal elements
                 auto __is_equal = [&__comp](_ForwardIterator2 __a, _ForwardIterator2 __b) -> bool {
@@ -2813,17 +2744,15 @@ __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwa
                 //2. testing is __a subsequence of the second range included into the first range
                 auto __b = std::lower_bound(__first1, __last1, *__i, __comp);
 
-                __PSTL_ASSERT(!__comp(*(__last1 - 1), *__b));
-                __PSTL_ASSERT(!__comp(*(__j - 1), *__i));
+                _PSTL_ASSERT(!__comp(*(__last1 - 1), *__b));
+                _PSTL_ASSERT(!__comp(*(__j - 1), *__i));
                 return !std::includes(__b, __last1, __i, __j, __comp);
             });
     });
 }
-#endif
 
 constexpr auto __set_algo_cut_off = 1000;
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
           class _Compare, class _IsVector, class _SizeFunction, class _SetOP>
 _OutputIterator
@@ -2849,14 +2778,14 @@ __parallel_set_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwar
 
     __par_backend::__buffer<_T> __buf(__size_func(__n1, __n2));
 
-    return __internal::__except_handler([&__exec, __n1, __first1, __last1, __first2, __last2, __result, __is_vector, __comp,
-                             __size_func, __set_op, &__buf]() {
+    return __internal::__except_handler([&__exec, __n1, __first1, __last1, __first2, __last2, __result, __is_vector,
+                                         __comp, __size_func, __set_op, &__buf]() {
         auto __buffer = __buf.get();
         _DifferenceType __m{};
         auto __scan = [=](_DifferenceType, _DifferenceType, const _SetRange& __s) { // Scan
             if (!__s.empty())
-                __internal::__brick_move(__buffer + __s.__buf_pos, __buffer + (__s.__buf_pos + __s.__len), __result + __s.__pos,
-                             __is_vector);
+                __internal::__brick_move(__buffer + __s.__buf_pos, __buffer + (__s.__buf_pos + __s.__len),
+                                         __result + __s.__pos, __is_vector);
         };
         __par_backend::__parallel_strict_scan(
             std::forward<_ExecutionPolicy>(__exec), __n1, _SetRange{0, 0, 0}, //-1, 0},
@@ -2912,38 +2841,36 @@ __parallel_set_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwar
         return __result + __m;
     });
 }
-#endif
 
-#if __PSTL_USE_PAR_POLICIES
 //a shared parallel pattern for '__pattern_set_union' and '__pattern_set_symmetric_difference'
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
           class _Compare, class _SetUnionOp, class _IsVector>
 _OutputIterator
 __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
-                      _ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result, _Compare __comp,
-                      _SetUnionOp __set_union_op, _IsVector __is_vector)
+                        _ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
+                        _Compare __comp, _SetUnionOp __set_union_op, _IsVector __is_vector)
 {
     typedef typename std::iterator_traits<_ForwardIterator1>::difference_type _DifferenceType;
 
     const auto __n1 = __last1 - __first1;
     const auto __n2 = __last2 - __first2;
 
-    auto copy_range1 = [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
+    auto __copy_range1 = [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
         return __internal::__brick_copy(__begin, __end, __res, __is_vector);
     };
-    auto copy_range2 = [__is_vector](_ForwardIterator2 __begin, _ForwardIterator2 __end, _OutputIterator __res) {
+    auto __copy_range2 = [__is_vector](_ForwardIterator2 __begin, _ForwardIterator2 __end, _OutputIterator __res) {
         return __internal::__brick_copy(__begin, __end, __res, __is_vector);
     };
 
     // {1} {}: parallel copying just first sequence
     if (__n2 == 0)
-        return __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result, copy_range1,
-                                     std::true_type());
+        return __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
+                                                 __copy_range1, std::true_type());
 
     // {} {2}: parallel copying justmake  second sequence
     if (__n1 == 0)
-        return __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2, __result, copy_range2,
-                                     std::true_type());
+        return __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2, __result,
+                                                 __copy_range2, std::true_type());
 
     // testing  whether the sequences are intersected
     _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
@@ -2951,16 +2878,16 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
     if (__left_bound_seq_1 == __last1)
     {
         //{1} < {2}: seq2 is wholly greater than seq1, so, do parallel copying seq1 and seq2
-        __par_backend::__parallel_invoke(std::forward<_ExecutionPolicy>(__exec),
-                                         [=] {
-                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
-                                                                   __last1, __result, copy_range1, std::true_type());
-                                         },
-                                         [=] {
-                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
-                                                                   __last2, __result + __n1, copy_range2,
-                                                                   std::true_type());
-                                         });
+        __par_backend::__parallel_invoke(
+            std::forward<_ExecutionPolicy>(__exec),
+            [=] {
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
+                                                  __copy_range1, std::true_type());
+            },
+            [=] {
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2,
+                                                  __result + __n1, __copy_range2, std::true_type());
+            });
         return __result + __n1 + __n2;
     }
 
@@ -2970,16 +2897,16 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
     if (__left_bound_seq_2 == __last2)
     {
         //{2} < {1}: seq2 is wholly greater than seq1, so, do parallel copying seq1 and seq2
-        __par_backend::__parallel_invoke(std::forward<_ExecutionPolicy>(__exec),
-                                         [=] {
-                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
-                                                                   __last2, __result, copy_range2, std::true_type());
-                                         },
-                                         [=] {
-                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
-                                                                   __last1, __result + __n2, copy_range1,
-                                                                   std::true_type());
-                                         });
+        __par_backend::__parallel_invoke(
+            std::forward<_ExecutionPolicy>(__exec),
+            [=] {
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2, __result,
+                                                  __copy_range2, std::true_type());
+            },
+            [=] {
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
+                                                  __result + __n2, __copy_range1, std::true_type());
+            });
         return __result + __n1 + __n2;
     }
 
@@ -2992,20 +2919,20 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
             std::forward<_ExecutionPolicy>(__exec),
             //do parallel copying of [first1; left_bound_seq_1)
             [=] {
-                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __left_bound_seq_1, __res_or,
-                                      copy_range1, std::true_type());
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __left_bound_seq_1,
+                                                  __res_or, __copy_range1, std::true_type());
             },
             [=, &__result] {
-                __result = __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1,
-                                             __first2, __last2, __result, __comp,
-                                             [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; },
-                                             __set_union_op, __is_vector);
+                __result = __internal::__parallel_set_op(
+                    std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1, __first2, __last2, __result,
+                    __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op,
+                    __is_vector);
             });
         return __result;
     }
 
     const auto __m2 = __left_bound_seq_2 - __first2;
-    __PSTL_ASSERT(__m1 == 0 || __m2 == 0);
+    _PSTL_ASSERT(__m1 == 0 || __m2 == 0);
     if (__m2 > __set_algo_cut_off)
     {
         auto __res_or = __result;
@@ -3014,23 +2941,22 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
             std::forward<_ExecutionPolicy>(__exec),
             //do parallel copying of [first2; left_bound_seq_2)
             [=] {
-                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __left_bound_seq_2, __res_or,
-                                      copy_range2, std::true_type());
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __left_bound_seq_2,
+                                                  __res_or, __copy_range2, std::true_type());
             },
             [=, &__result] {
-                __result = __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
-                                             __left_bound_seq_2, __last2, __result, __comp,
-                                             [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; },
-                                             __set_union_op, __is_vector);
+                __result = __internal::__parallel_set_op(
+                    std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __left_bound_seq_2, __last2, __result,
+                    __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op,
+                    __is_vector);
             });
         return __result;
     }
 
-    return __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
-                             __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op,
-                             __is_vector);
+    return __internal::__parallel_set_op(
+        std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result, __comp,
+        [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op, __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // set_union
@@ -3051,7 +2977,7 @@ __brick_set_union(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _Forwar
                   _ForwardIterator2 __last2, _OutputIterator __result, _Compare __comp,
                   /*__is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::set_union(__first1, __last1, __first2, __last2, __result, __comp);
 }
 
@@ -3066,7 +2992,6 @@ __pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIter
     return __internal::__brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
           class _Compare, class _IsVector>
 _OutputIterator
@@ -3083,15 +3008,13 @@ __pattern_set_union(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forw
         return std::set_union(__first1, __last1, __first2, __last2, __result, __comp);
 
     typedef typename std::iterator_traits<_OutputIterator>::value_type _T;
-    return __internal::__parallel_set_union_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
-                                 __comp,
-                                 [](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
-                                    _ForwardIterator2 __last2, _T* __result, _Compare __comp) {
-                                     return std::set_union(__first1, __last1, __first2, __last2, __result, __comp);
-                                 },
-                                 __is_vector);
+    return __internal::__parallel_set_union_op(
+        std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result, __comp,
+        [](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+           _T* __result,
+           _Compare __comp) { return std::set_union(__first1, __last1, __first2, __last2, __result, __comp); },
+        __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // set_intersection
@@ -3112,7 +3035,7 @@ __brick_set_intersection(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
                          _ForwardIterator2 __last2, _OutputIterator __result, _Compare __comp,
                          /*__is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::set_intersection(__first1, __last1, __first2, __last2, __result, __comp);
 }
 
@@ -3126,7 +3049,6 @@ __pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forw
     return __internal::__brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
           class _Compare, class _IsVector>
 _OutputIterator
@@ -3188,7 +3110,6 @@ __pattern_set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1
     // [left_bound_seq_1; last1) and [left_bound_seq_2; last2) - use serial algorithm
     return std::set_intersection(__left_bound_seq_1, __last1, __left_bound_seq_2, __last2, __result, __comp);
 }
-#endif
 
 //------------------------------------------------------------------------
 // set_difference
@@ -3209,7 +3130,7 @@ __brick_set_difference(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _F
                        _ForwardIterator2 __last2, _OutputIterator __result, _Compare __comp,
                        /*__is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::set_difference(__first1, __last1, __first2, __last2, __result, __comp);
 }
 
@@ -3223,7 +3144,6 @@ __pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forwar
     return __internal::__brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
           class _Compare, class _IsVector>
 _OutputIterator
@@ -3273,18 +3193,17 @@ __pattern_set_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1,
             std::true_type());
 
     if (__n1 + __n2 > __set_algo_cut_off)
-        return __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
-                                 __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n; },
-                                 [](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
-                                    _ForwardIterator2 __last2, _T* __result, _Compare __comp) {
-                                     return std::set_difference(__first1, __last1, __first2, __last2, __result, __comp);
-                                 },
-                                 __is_vector);
+        return __internal::__parallel_set_op(
+            std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result, __comp,
+            [](_DifferenceType __n, _DifferenceType __m) { return __n; },
+            [](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
+               _ForwardIterator2 __last2, _T* __result,
+               _Compare __comp) { return std::set_difference(__first1, __last1, __first2, __last2, __result, __comp); },
+            __is_vector);
 
     // use serial algorithm
     return std::set_difference(__first1, __last1, __first2, __last2, __result, __comp);
 }
-#endif
 
 //------------------------------------------------------------------------
 // set_symmetric_difference
@@ -3305,7 +3224,7 @@ __brick_set_symmetric_difference(_ForwardIterator1 __first1, _ForwardIterator1 _
                                  _ForwardIterator2 __last2, _OutputIterator __result, _Compare __comp,
                                  /*__is_vector=*/std::true_type) noexcept
 {
-    __PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
+    _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented, redirected to serial");
     return std::set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
 }
 
@@ -3316,10 +3235,10 @@ __pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1 __first
                                    _ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
                                    _Compare __comp, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __internal::__brick_set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+    return __internal::__brick_set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp,
+                                                        __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
           class _Compare, class _IsVector>
 _OutputIterator
@@ -3344,7 +3263,6 @@ __pattern_set_symmetric_difference(_ExecutionPolicy&& __exec, _ForwardIterator1
         },
         __is_vector);
 }
-#endif
 
 //------------------------------------------------------------------------
 // is_heap_until
@@ -3382,7 +3300,7 @@ __pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator __first, _Rand
 template <class _RandomAccessIterator, class _DifferenceType, class _Compare>
 _RandomAccessIterator
 __is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp,
-                    /* __is_vector = */ std::false_type) noexcept
+                      /* __is_vector = */ std::false_type) noexcept
 {
     _DifferenceType __i = __begin;
     for (; __i < __end; ++__i)
@@ -3398,14 +3316,13 @@ __is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _D
 template <class _RandomAccessIterator, class _DifferenceType, class _Compare>
 _RandomAccessIterator
 __is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp,
-                    /* __is_vector = */ std::true_type) noexcept
+                      /* __is_vector = */ std::true_type) noexcept
 {
     return __unseq_backend::__simd_first(
         __first, __begin, __end,
         [&__comp](_RandomAccessIterator __it, _DifferenceType __i) { return __comp(__it[(__i - 1) / 2], __it[__i]); });
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
 _RandomAccessIterator
 __pattern_is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last,
@@ -3423,7 +3340,6 @@ __pattern_is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first
             std::less<typename std::iterator_traits<_RandomAccessIterator>::difference_type>(), /*is_first=*/true);
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // min_element
@@ -3442,7 +3358,7 @@ _ForwardIterator
 __brick_min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
                     /* __is_vector = */ std::true_type) noexcept
 {
-#if __PSTL_UDR_PRESENT
+#if _PSTL_UDR_PRESENT
     return __unseq_backend::__simd_min_element(__first, __last - __first, __comp);
 #else
     return std::min_element(__first, __last, __comp);
@@ -3457,7 +3373,6 @@ __pattern_min_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIter
     return __internal::__brick_min_element(__first, __last, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <typename _ExecutionPolicy, typename _RandomAccessIterator, typename _Compare, typename _IsVector>
 _RandomAccessIterator
 __pattern_min_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last,
@@ -3471,7 +3386,8 @@ __pattern_min_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
             std::forward<_ExecutionPolicy>(__exec), __first + 1, __last, __first,
             [=](_RandomAccessIterator __begin, _RandomAccessIterator __end,
                 _RandomAccessIterator __init) -> _RandomAccessIterator {
-                const _RandomAccessIterator subresult = __internal::__brick_min_element(__begin, __end, __comp, __is_vector);
+                const _RandomAccessIterator subresult =
+                    __internal::__brick_min_element(__begin, __end, __comp, __is_vector);
                 return __internal::__cmp_iterators_by_values(__init, subresult, __comp);
             },
             [=](_RandomAccessIterator __it1, _RandomAccessIterator __it2) -> _RandomAccessIterator {
@@ -3479,7 +3395,6 @@ __pattern_min_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
             });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // minmax_element
@@ -3498,7 +3413,7 @@ std::pair<_ForwardIterator, _ForwardIterator>
 __brick_minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
                        /* __is_vector = */ std::true_type) noexcept
 {
-#if __PSTL_UDR_PRESENT
+#if _PSTL_UDR_PRESENT
     return __unseq_backend::__simd_minmax_element(__first, __last - __first, __comp);
 #else
     return std::minmax_element(__first, __last, __comp);
@@ -3513,7 +3428,6 @@ __pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI
     return __internal::__brick_minmax_element(__first, __last, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <typename _ExecutionPolicy, typename _ForwardIterator, typename _Compare, typename _IsVector>
 std::pair<_ForwardIterator, _ForwardIterator>
 __pattern_minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
@@ -3529,9 +3443,9 @@ __pattern_minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
             std::forward<_ExecutionPolicy>(__exec), __first + 1, __last, std::make_pair(__first, __first),
             [=](_ForwardIterator __begin, _ForwardIterator __end, _Result __init) -> _Result {
                 const _Result __subresult = __internal::__brick_minmax_element(__begin, __end, __comp, __is_vector);
-                return std::make_pair(
-                    __internal::__cmp_iterators_by_values(__subresult.first, __init.first, __comp),
-                    __internal::__cmp_iterators_by_values(__init.second, __subresult.second, __not_pred<_Compare>(__comp)));
+                return std::make_pair(__internal::__cmp_iterators_by_values(__subresult.first, __init.first, __comp),
+                                      __internal::__cmp_iterators_by_values(__init.second, __subresult.second,
+                                                                            __not_pred<_Compare>(__comp)));
             },
             [=](_Result __p1, _Result __p2) -> _Result {
                 return std::make_pair(
@@ -3540,7 +3454,6 @@ __pattern_minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
             });
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // mismatch
@@ -3550,7 +3463,7 @@ std::pair<_ForwardIterator1, _ForwardIterator2>
 __mismatch_serial(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
                   _ForwardIterator2 __last2, _BinaryPredicate __pred)
 {
-#if __PSTL_CPP14_2RANGE_MISMATCH_EQUAL_PRESENT
+#if _PSTL_CPP14_2RANGE_MISMATCH_EQUAL_PRESENT
     return std::mismatch(__first1, __last1, __first2, __last2, __pred);
 #else
     for (; __first1 != __last1 && __first2 != __last2 && __pred(*__first1, *__first2); ++__first1, ++__first2)
@@ -3586,7 +3499,6 @@ __pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardItera
     return __internal::__brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Predicate,
           class _IsVector>
 std::pair<_RandomAccessIterator1, _RandomAccessIterator2>
@@ -3599,15 +3511,14 @@ __pattern_mismatch(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _
         auto __result = __internal::__parallel_find(
             std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
             [__first1, __first2, __pred, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
-                return __internal::__brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1), __pred,
-                                        __is_vector)
+                return __internal::__brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1),
+                                                    __pred, __is_vector)
                     .first;
             },
             std::less<typename std::iterator_traits<_RandomAccessIterator1>::difference_type>(), /*is_first=*/true);
         return std::make_pair(__result, __first2 + (__result - __first1));
     });
 }
-#endif
 
 //------------------------------------------------------------------------
 // lexicographical_compare
@@ -3667,7 +3578,6 @@ __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1 __first1
     return __internal::__brick_lexicographical_compare(__first1, __last1, __first2, __last2, __comp, __is_vector);
 }
 
-#if __PSTL_USE_PAR_POLICIES
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector>
 bool
 __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
@@ -3693,10 +3603,10 @@ __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 _
             std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
             [__first1, __first2, &__comp, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
                 return __internal::__brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1),
-                                        [&__comp](const _RefType1 __x, const _RefType2 __y) {
-                                            return !__comp(__x, __y) && !__comp(__y, __x);
-                                        },
-                                        __is_vector)
+                                                    [&__comp](const _RefType1 __x, const _RefType2 __y) {
+                                                        return !__comp(__x, __y) && !__comp(__y, __x);
+                                                    },
+                                                    __is_vector)
                     .first;
             },
             std::less<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/true);
@@ -3711,9 +3621,8 @@ __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 _
         }
     }
 }
-#endif
 
 } // namespace __internal
 } // namespace __pstl
 
-#endif /* __PSTL_algorithm_impl_H */
+#endif /* _PSTL_ALGORITHM_IMPL_H */