Add PSTL internal namespace qualifications
authorThomas Rodgers <trodgers@redhat.com>
Tue, 9 Apr 2019 15:45:26 +0000 (15:45 +0000)
committerThomas Rodgers <rodgertq@gcc.gnu.org>
Tue, 9 Apr 2019 15:45:26 +0000 (15:45 +0000)
* include/pstl/algorithm_impl.h: Add namespace qualification.
* include/pstl/execution_defs.h: Add namespace qualification.
* include/pstl/execution_impl.h: Add namespace qualification.
* include/pstl/numeric_impl.h: Add namespace qualification.
* include/pstl/parallel_backend_tbb.h: Add namespace qualification.
* include/pstl/unseq_backend_simd.h: Add namespace qualification.
* include/pstl/parallel_backend_utils.h: Include <cassert>.

From-SVN: r270231

libstdc++-v3/ChangeLog
libstdc++-v3/include/pstl/algorithm_impl.h
libstdc++-v3/include/pstl/execution_defs.h
libstdc++-v3/include/pstl/execution_impl.h
libstdc++-v3/include/pstl/numeric_impl.h
libstdc++-v3/include/pstl/parallel_backend_tbb.h
libstdc++-v3/include/pstl/parallel_backend_utils.h
libstdc++-v3/include/pstl/unseq_backend_simd.h

index f363c44df4ae10e90a1a18e1bc0e52ff20947426..eaad7c62100d028510b5c8f936da4408d75a3a29 100644 (file)
@@ -1,3 +1,13 @@
+2019-04-09  Thomas Rodgers  <trodgers@redhat.com>
+
+       * include/pstl/algorithm_impl.h: Add namespace qualification.
+       * include/pstl/execution_defs.h: Add namespace qualification.
+       * include/pstl/execution_impl.h: Add namespace qualification.
+       * include/pstl/numeric_impl.h: Add namespace qualification.
+       * include/pstl/parallel_backend_tbb.h: Add namespace qualification.
+       * include/pstl/unseq_backend_simd.h: Add namespace qualification.
+       * include/pstl/parallel_backend_utils.h: Include <cassert>.
+
 2019-04-08  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        Fix visit<R> for variant.
index 9d8242873ab7dfd304c48dedfe148ad8261dfb1d..e06bf60151e7b2a09745750198868d31193f267e 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "execution_impl.h"
 #include "memory_impl.h"
+#include "parallel_backend_utils.h"
 #include "unseq_backend_simd.h"
 
 #if __PSTL_USE_PAR_POLICIES
@@ -55,7 +56,7 @@ bool
 __pattern_any_of(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred,
                  _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __brick_any_of(__first, __last, __pred, __is_vector);
+    return __internal::__brick_any_of(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -64,10 +65,10 @@ bool
 __pattern_any_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred,
                  _IsVector __is_vector, /*parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
-        return __parallel_or(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+    return __internal::__except_handler([&]() {
+       return __internal::__parallel_or(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                              [__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                                 return __brick_any_of(__i, __j, __pred, __is_vector);
+                                 return __internal::__brick_any_of(__i, __j, __pred, __is_vector);
                              });
     });
 }
@@ -111,7 +112,7 @@ __pattern_walk1(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator _
                 _IsVector __is_vector,
                 /*parallel=*/std::false_type) noexcept
 {
-    __brick_walk1(__first, __last, __f, __is_vector);
+    __internal::__brick_walk1(__first, __last, __f, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -121,10 +122,10 @@ __pattern_walk1(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
                 _IsVector __is_vector,
                 /*parallel=*/std::true_type)
 {
-    __except_handler([&]() {
+    __internal::__except_handler([&]() {
         __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                                       [__f, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                                          __brick_walk1(__i, __j, __f, __is_vector);
+                                          __internal::__brick_walk1(__i, __j, __f, __is_vector);
                                       });
     });
 }
@@ -144,7 +145,7 @@ void
 __pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Brick __brick,
                      /*parallel=*/std::true_type)
 {
-    __except_handler([&]() {
+    __internal::__except_handler([&]() {
         __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                                       [__brick](_ForwardIterator __i, _ForwardIterator __j) { __brick(__i, __j); });
     });
@@ -158,7 +159,7 @@ template <class _ForwardIterator, class _Size, class _Function>
 _ForwardIterator
 __brick_walk1_n(_ForwardIterator __first, _Size __n, _Function __f, /*_IsVectorTag=*/std::false_type)
 {
-    return __for_each_n_it_serial(__first, __n,
+    return __internal::__for_each_n_it_serial(__first, __n,
                                   [&__f](_ForwardIterator __it) { __f(*__it); }); // calling serial version
 }
 
@@ -175,7 +176,7 @@ _ForwardIterator
 __pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator __first, _Size __n, _Function __f, _IsVector __is_vector,
                   /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_walk1_n(__first, __n, __f, __is_vector);
+    return __internal::__brick_walk1_n(__first, __n, __f, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -185,7 +186,7 @@ __pattern_walk1_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Siz
                   _IsVector __is_vector,
                   /*is_parallel=*/std::true_type)
 {
-    __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
@@ -204,7 +205,7 @@ _RandomAccessIterator
 __pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Brick __brick,
                        /*is_parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_for(
             std::forward<_ExecutionPolicy>(__exec), __first, __first + __n,
             [__brick](_RandomAccessIterator __i, _RandomAccessIterator __j) { __brick(__i, __j - __i); });
@@ -259,7 +260,7 @@ _ForwardIterator2
 __pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
                 _Function __f, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __brick_walk2(__first1, __last1, __first2, __f, __is_vector);
+    return __internal::__brick_walk2(__first1, __last1, __first2, __f, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -268,11 +269,11 @@ _ForwardIterator2
 __pattern_walk2(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
                 _ForwardIterator2 __first2, _Function __f, _IsVector __is_vector, /*parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_for(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
             [__f, __first1, __first2, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                __brick_walk2(__i, __j, __first2 + (__i - __first1), __f, __is_vector);
+                __internal::__brick_walk2(__i, __j, __first2 + (__i - __first1), __f, __is_vector);
             });
         return __first2 + (__last1 - __first1);
     });
@@ -285,7 +286,7 @@ _ForwardIterator2
 __pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Size n, _ForwardIterator2 __first2, _Function f,
                   _IsVector is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __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,
@@ -294,7 +295,7 @@ _RandomAccessIterator2
 __pattern_walk2_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size n, _RandomAccessIterator2 __first2,
                   _Function f, _IsVector is_vector, /*parallel=*/std::true_type)
 {
-    return __pattern_walk2(std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + n, __first2, f, is_vector,
+    return __internal::__pattern_walk2(std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + n, __first2, f, is_vector,
                            std::true_type());
 }
 
@@ -312,7 +313,7 @@ _RandomAccessIterator2
 __pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
                       _RandomAccessIterator2 __first2, _Brick __brick, /*parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_for(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
             [__first1, __first2, __brick](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
@@ -329,7 +330,7 @@ _RandomAccessIterator2
 __pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size __n,
                         _RandomAccessIterator2 __first2, _Brick __brick, /*parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_for(
             std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
             [__first1, __first2, __brick](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
@@ -377,7 +378,7 @@ _ForwardIterator3
 __pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
                 _ForwardIterator3 __first3, _Function __f, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector);
+    return __internal::__brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -388,11 +389,11 @@ __pattern_walk3(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
                 _RandomAccessIterator2 __first2, _RandomAccessIterator3 __first3, _Function __f, _IsVector __is_vector,
                 /*parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_for(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
             [__f, __first1, __first2, __first3, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
-                __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);
     });
@@ -426,7 +427,7 @@ bool
 __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
                 _BinaryPredicate __p, _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_equal(__first1, __last1, __first2, __p, __is_vector);
+    return __internal::__brick_equal(__first1, __last1, __first2, __p, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -437,11 +438,11 @@ __pattern_equal(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
                 _RandomAccessIterator2 __first2, _BinaryPredicate __p, _IsVector __is_vector,
                 /*is_parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
-        return !__parallel_or(
+    return __internal::__except_handler([&]() {
+        return !__internal::__parallel_or(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
             [__first1, __first2, __p, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
-                return !__brick_equal(__i, __j, __first2 + (__i - __first1), __p, __is_vector);
+                return !__internal::__brick_equal(__i, __j, __first2 + (__i - __first1), __p, __is_vector);
             });
     });
 }
@@ -475,7 +476,7 @@ __pattern_find_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
                   _IsVector __is_vector,
                   /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_find_if(__first, __last, __pred, __is_vector);
+    return __internal::__brick_find_if(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -485,10 +486,10 @@ __pattern_find_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
                   _IsVector __is_vector,
                   /*is_parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
-        return __parallel_find(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+    return __internal::__except_handler([&]() {
+                       return __internal::__parallel_find(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                                [__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                                   return __brick_find_if(__i, __j, __pred, __is_vector);
+                                   return __internal::__brick_find_if(__i, __j, __pred, __is_vector);
                                },
                                std::less<typename std::iterator_traits<_ForwardIterator>::difference_type>(),
                                /*is_first=*/true);
@@ -526,14 +527,14 @@ __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 = __brick_find_if(__first, __last,
+        __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
         // (b_first == false)
         if (__first != __last && (__global_last - __first >= __n2) &&
-            __brick_equal(__s_first + 1, __s_last, __first + 1, __pred, __is_vector))
+            __internal::__brick_equal(__s_first + 1, __s_last, __first + 1, __pred, __is_vector))
         {
             if (__b_first)
             {
@@ -573,11 +574,11 @@ __find_subrange(_RandomAccessIterator __first, _RandomAccessIterator __last, _Ra
     auto __unary_pred = __equal_value_by_pred<_Tp, _BinaryPredicate>(__value, __pred);
     while (__first != __last && (__global_last - __first >= __count))
     {
-        __first = __brick_find_if(__first, __last, __unary_pred, __is_vector);
+        __first = __internal::__brick_find_if(__first, __last, __unary_pred, __is_vector);
 
         // check that all of elements in [first+1, first+count) equal to value
         if (__first != __last && (__global_last - __first >= __count) &&
-            !__brick_any_of(__first + 1, __first + __count, __not_pred<decltype(__unary_pred)>(__unary_pred),
+            !__internal::__brick_any_of(__first + 1, __first + __count, __not_pred<decltype(__unary_pred)>(__unary_pred),
                             __is_vector))
         {
             return __first;
@@ -617,7 +618,7 @@ __pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardIterat
                    _ForwardIterator2 __s_last, _BinaryPredicate __pred, _IsVector __is_vector,
                    /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector);
+    return __internal::__brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -630,17 +631,17 @@ __pattern_find_end(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _Forwar
 {
     if (__last - __first == __s_last - __s_first)
     {
-        const bool __res = __pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
+        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 __except_handler([&]() {
-            return __parallel_find(
+        return __internal::__except_handler([&]() {
+           return __internal::__parallel_find(
                 std::forward<_ExecutionPolicy>(__exec), __first, __last,
                 [__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                    return __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);
         });
@@ -674,7 +675,7 @@ __pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardI
                         _ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred,
                         _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector);
+    return __internal::__brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -685,11 +686,11 @@ __pattern_find_first_of(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _F
                         _ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred,
                         _IsVector __is_vector, /*is_parallel=*/std::true_type) noexcept
 {
-    return __except_handler([&]() {
-        return __parallel_find(
+    return __internal::__except_handler([&]() {
+         return __internal::__parallel_find(
             std::forward<_ExecutionPolicy>(__exec), __first, __last,
             [__s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                return __brick_find_first_of(__i, __j, __s_first, __s_last, __pred, __is_vector);
+                return __internal::__brick_find_first_of(__i, __j, __s_first, __s_last, __pred, __is_vector);
             },
             std::less<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/true);
     });
@@ -712,7 +713,7 @@ _ForwardIterator1
 __brick_search(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
                _ForwardIterator2 __s_last, _BinaryPredicate __pred, /*vector=*/std::true_type) noexcept
 {
-    return __find_subrange(__first, __last, __last, __s_first, __s_last, __pred, true, std::true_type());
+    return __internal::__find_subrange(__first, __last, __last, __s_first, __s_last, __pred, true, std::true_type());
 }
 
 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
@@ -722,7 +723,7 @@ __pattern_search(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardIterator
                  _ForwardIterator2 __s_last, _BinaryPredicate __pred, _IsVector __is_vector,
                  /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector);
+    return __internal::__brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -736,17 +737,17 @@ __pattern_search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardI
 {
     if (__last - __first == __s_last - __s_first)
     {
-        const bool __res = __pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
+        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 __except_handler([&]() {
-            return __parallel_find(
+        return __internal::__except_handler([&]() {
+            return __internal::__parallel_find(
                 std::forward<_ExecutionPolicy>(__exec), __first, __last,
                 [__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                    return __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);
         });
@@ -770,7 +771,7 @@ _ForwardIterator
 __brick_search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value,
                  _BinaryPredicate __pred, /*vector=*/std::true_type) noexcept
 {
-    return __find_subrange(__first, __last, __last, __count, __value, __pred, std::true_type());
+    return __internal::__find_subrange(__first, __last, __last, __count, __value, __pred, std::true_type());
 }
 
 template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate,
@@ -780,7 +781,7 @@ __pattern_search_n(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterato
                    const _Tp& __value, _BinaryPredicate __pred, _IsVector __is_vector,
                    /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_search_n(__first, __last, __count, __value, __pred, __is_vector);
+    return __internal::__brick_search_n(__first, __last, __count, __value, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -794,18 +795,18 @@ __pattern_search_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ra
     if (__last - __first == __count)
     {
         const bool __result =
-            !__pattern_any_of(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+            !__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
     {
-        return __except_handler([&__exec, __first, __last, __count, &__value, __pred, __is_vector]() {
-            return __parallel_find(
+        return __internal::__except_handler([&__exec, __first, __last, __count, &__value, __pred, __is_vector]() {
+            return __internal::__parallel_find(
                 std::forward<_ExecutionPolicy>(__exec), __first, __last,
                 [__last, __count, &__value, __pred, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j) {
-                    return __find_subrange(__i, __j, __last, __count, __value, __pred, __is_vector);
+                    return __internal::__find_subrange(__i, __j, __last, __count, __value, __pred, __is_vector);
                 },
                 std::less<typename std::iterator_traits<_RandomAccessIterator>::difference_type>(), /*is_first=*/true);
         });
@@ -973,7 +974,7 @@ __brick_copy_by_mask(_ForwardIterator __first, _ForwardIterator __last, _OutputI
 #if (__PSTL_MONOTONIC_PRESENT)
     __unseq_backend::__simd_copy_by_mask(__first, __last - __first, __result, __mask, __assigner);
 #else
-    __brick_copy_by_mask(__first, __last, __result, __mask, __assigner, std::false_type());
+    __internal::__brick_copy_by_mask(__first, __last, __result, __mask, __assigner, std::false_type());
 #endif
 }
 
@@ -1005,7 +1006,7 @@ __brick_partition_by_mask(_RandomAccessIterator __first, _RandomAccessIterator _
 #if (__PSTL_MONOTONIC_PRESENT)
     __unseq_backend::__simd_partition_by_mask(__first, __last - __first, __out_true, __out_false, __mask);
 #else
-    __brick_partition_by_mask(__first, __last, __out_true, __out_false, __mask, std::false_type());
+    __internal::__brick_partition_by_mask(__first, __last, __out_true, __out_false, __mask, std::false_type());
 #endif
 }
 
@@ -1014,7 +1015,7 @@ _OutputIterator
 __pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
                   _UnaryPredicate __pred, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __brick_copy_if(__first, __last, __result, __pred, __is_vector);
+    return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1029,19 +1030,19 @@ __pattern_copy_if(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ran
     if (_DifferenceType(1) < __n)
     {
         __par_backend::__buffer<bool> __mask_buf(__n);
-        return __except_handler([&__exec, __n, __first, __result, __is_vector, __pred, &__mask_buf]() {
+        return __internal::__except_handler([&__exec, __n, __first, __result, __is_vector, __pred, &__mask_buf]() {
             bool* __mask = __mask_buf.get();
             _DifferenceType __m{};
             __par_backend::parallel_strict_scan(
                 std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
                 [=](_DifferenceType __i, _DifferenceType __len) { // Reduce
-                    return __brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
+                    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
-                    __brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
+                    __internal::__brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
                                          [](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; },
                                          __is_vector);
                 },
@@ -1050,7 +1051,7 @@ __pattern_copy_if(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ran
         });
     }
     // trivial sequence - use serial algorithm
-    return __brick_copy_if(__first, __last, __result, __pred, __is_vector);
+    return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector);
 }
 #endif
 
@@ -1078,7 +1079,7 @@ typename std::iterator_traits<_ForwardIterator>::difference_type
 __pattern_count(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
                 /* is_parallel */ std::false_type, _IsVector __is_vector) noexcept
 {
-    return __brick_count(__first, __last, __pred, __is_vector);
+    return __internal::__brick_count(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1088,11 +1089,11 @@ __pattern_count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
                 /* is_parallel */ std::true_type, _IsVector __is_vector)
 {
     typedef typename std::iterator_traits<_ForwardIterator>::difference_type _SizeType;
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         return __par_backend::__parallel_reduce(
             std::forward<_ExecutionPolicy>(__exec), __first, __last, _SizeType(0),
             [__pred, __is_vector](_ForwardIterator __begin, _ForwardIterator __end, _SizeType __value) -> _SizeType {
-                return __value + __brick_count(__begin, __end, __pred, __is_vector);
+                return __value + __internal::__brick_count(__begin, __end, __pred, __is_vector);
             },
             std::plus<_SizeType>());
     });
@@ -1125,7 +1126,7 @@ _ForwardIterator
 __pattern_unique(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred,
                  _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_unique(__first, __last, __pred, __is_vector);
+    return __internal::__brick_unique(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1133,7 +1134,7 @@ __pattern_unique(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator
 // 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,
+__remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _CalcMask __calc_mask,
                 _IsVector __is_vector)
 {
     typedef typename std::iterator_traits<_ForwardIterator>::difference_type _DifferenceType;
@@ -1141,7 +1142,7 @@ remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
     _DifferenceType __n = __last - __first;
     __par_backend::__buffer<bool> __mask_buf(__n);
     // 1. find a first iterator that should be removed
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         bool* __mask = __mask_buf.get();
         _DifferenceType __min = __par_backend::__parallel_reduce(
             std::forward<_ExecutionPolicy>(__exec), _DifferenceType(0), __n, __n,
@@ -1157,7 +1158,7 @@ remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
                 }
                 // find first iterator that should be removed
                 bool* __result =
-                    __brick_find_if(__mask + __i, __mask + __j, [](bool __val) { return !__val; }, __is_vector);
+                    __internal::__brick_find_if(__mask + __i, __mask + __j, [](bool __val) { return !__val; }, __is_vector);
                 if (__result - __mask == __j)
                 {
                     return __local_min;
@@ -1184,13 +1185,13 @@ remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
         __par_backend::parallel_strict_scan(
             std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
             [__mask, __is_vector](_DifferenceType __i, _DifferenceType __len) {
-                return __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) {
-                __brick_copy_by_mask(__first + __i, __first + __i + __len, __result + __initial, __mask + __i,
+                __internal::__brick_copy_by_mask(__first + __i, __first + __i + __len, __result + __initial, __mask + __i,
                                      [](_ForwardIterator __x, _Tp* __z) {
-                                         __invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
+                                         __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
                                                           [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
                                      },
                                      __is_vector);
@@ -1200,7 +1201,7 @@ remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte
         // 3. Elements from result are moved to [first, last)
         __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __result, __result + __m,
                                       [__result, __first, __is_vector](_Tp* __i, _Tp* __j) {
-                                          __brick_move(__i, __j, __first + (__i - __result), __is_vector);
+                                          __internal::__brick_move(__i, __j, __first + (__i - __result), __is_vector);
                                       });
         return __first + __m;
     });
@@ -1222,12 +1223,12 @@ __pattern_unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt
     if (__first + 1 == __last || __first + 2 == __last)
     {
         // Trivial sequence - use serial algorithm
-        return __brick_unique(__first, __last, __pred, __is_vector);
+        return __internal::__brick_unique(__first, __last, __pred, __is_vector);
     }
-    return remove_elements(
+    return __internal::__remove_elements(
         std::forward<_ExecutionPolicy>(__exec), ++__first, __last,
         [&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
-            __brick_walk3(__b, __e, __it - 1, __it,
+            __internal::__brick_walk3(__b, __e, __it - 1, __it,
                           [&__pred](bool& __x, _ReferenceType __y, _ReferenceType __z) { __x = !__pred(__y, __z); },
                           __is_vector);
         },
@@ -1265,7 +1266,7 @@ _OutputIterator
 __pattern_unique_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
                       _BinaryPredicate __pred, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
 {
-    return __brick_unique_copy(__first, __last, __result, __pred, __is_vector);
+    return __internal::__brick_unique_copy(__first, __last, __result, __pred, __is_vector);
 }
 
 template <class _DifferenceType, class _RandomAccessIterator, class _BinaryPredicate>
@@ -1305,7 +1306,7 @@ __pattern_unique_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
         __par_backend::__buffer<bool> __mask_buf(__n);
         if (_DifferenceType(2) < __n)
         {
-            return __except_handler([&__exec, __n, __first, __result, __pred, __is_vector, &__mask_buf]() {
+            return __internal::__except_handler([&__exec, __n, __first, __result, __pred, __is_vector, &__mask_buf]() {
                 bool* __mask = __mask_buf.get();
                 _DifferenceType __m{};
                 __par_backend::parallel_strict_scan(
@@ -1321,14 +1322,14 @@ __pattern_unique_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
                             ++__i;
                             ++__extra;
                         }
-                        return __brick_calc_mask_2<_DifferenceType>(__first + __i, __first + (__i + __len),
+                        return __internal::__brick_calc_mask_2<_DifferenceType>(__first + __i, __first + (__i + __len),
                                                                     __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
-                        __brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
+                        __internal::__brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
                                              [](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; },
                                              __is_vector);
                     },
@@ -1338,7 +1339,7 @@ __pattern_unique_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
         }
     }
     // trivial sequence - use serial algorithm
-    return __brick_unique_copy(__first, __last, __result, __pred, __is_vector);
+    return __internal::__brick_unique_copy(__first, __last, __result, __pred, __is_vector);
 }
 #endif
 
@@ -1400,7 +1401,7 @@ __pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bidirecti
                   _IsVector _is_vector,
                   /*is_parallel=*/std::false_type) noexcept
 {
-    __brick_reverse(__first, __last, _is_vector);
+    __internal::__brick_reverse(__first, __last, _is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1412,7 +1413,7 @@ __pattern_reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _Bi
     __par_backend::__parallel_for(
         std::forward<_ExecutionPolicy>(__exec), __first, __first + (__last - __first) / 2,
         [__is_vector, __first, __last](_BidirectionalIterator __inner_first, _BidirectionalIterator __inner_last) {
-            __brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector);
+            __internal::__brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector);
         });
 }
 #endif
@@ -1446,7 +1447,7 @@ _OutputIterator
 __pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator __first, _BidirectionalIterator __last,
                        _OutputIterator __d_first, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_reverse_copy(__first, __last, __d_first, __is_vector);
+    return __internal::__brick_reverse_copy(__first, __last, __d_first, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1459,7 +1460,7 @@ __pattern_reverse_copy(_ExecutionPolicy&& __exec, _BidirectionalIterator __first
     __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                                   [__is_vector, __first, __len, __d_first](_BidirectionalIterator __inner_first,
                                                                            _BidirectionalIterator __inner_last) {
-                                      __brick_reverse_copy(__inner_first, __inner_last,
+                                      __internal::__brick_reverse_copy(__inner_first, __inner_last,
                                                            __d_first + (__len - (__inner_last - __first)), __is_vector);
                                   });
     return __d_first + __len;
@@ -1528,7 +1529,7 @@ _ForwardIterator
 __pattern_rotate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
                  _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_rotate(__first, __middle, __last, __is_vector);
+    return __internal::__brick_rotate(__first, __middle, __last, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1543,22 +1544,22 @@ __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt
     if (__m <= __n / 2)
     {
         __par_backend::__buffer<_Tp> __buf(__n - __m);
-        return __except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
+        return __internal::__except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
             _Tp* __result = __buf.get();
             __par_backend::__parallel_for(
                 std::forward<_ExecutionPolicy>(__exec), __middle, __last,
                 [__middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
-                    __brick_uninitialized_move(__b, __e, __result + (__b - __middle), __is_vector);
+                    __internal::__brick_uninitialized_move(__b, __e, __result + (__b - __middle), __is_vector);
                 });
 
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __middle,
                                           [__last, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
-                                              __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) {
-                                              __brick_move(__b, __e, __first + (__b - __result), __is_vector);
+                                              __internal::__brick_move(__b, __e, __first + (__b - __result), __is_vector);
                                           });
 
             return __first + (__last - __middle);
@@ -1567,22 +1568,22 @@ __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt
     else
     {
         __par_backend::__buffer<_Tp> __buf(__m);
-        return __except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
+        return __internal::__except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
             _Tp* __result = __buf.get();
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __middle,
                                           [__first, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
-                                              __brick_uninitialized_move(__b, __e, __result + (__b - __first),
+                                              __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) {
-                                              __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) {
-                                              __brick_move(__b, __e, __first + ((__n - __m) + (__b - __result)),
+                                              __internal::__brick_move(__b, __e, __first + ((__n - __m) + (__b - __result)),
                                                            __is_vector);
                                           });
 
@@ -1609,8 +1610,8 @@ _OutputIterator
 __brick_rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
                     _OutputIterator __result, /*__is_vector=*/std::true_type) noexcept
 {
-    _OutputIterator __res = __brick_copy(__middle, __last, __result, std::true_type());
-    return __brick_copy(__first, __middle, __res, std::true_type());
+    _OutputIterator __res = __internal::__brick_copy(__middle, __last, __result, std::true_type());
+    return __internal::__brick_copy(__first, __middle, __res, std::true_type());
 }
 
 template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _IsVector>
@@ -1618,7 +1619,7 @@ _OutputIterator
 __pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
                       _OutputIterator __result, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_rotate_copy(__first, __middle, __last, __result, __is_vector);
+    return __internal::__brick_rotate_copy(__first, __middle, __last, __result, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1633,19 +1634,19 @@ __pattern_rotate_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forw
         [__first, __last, __middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
             if (__b > __middle)
             {
-                __brick_copy(__b, __e, __result + (__b - __middle), __is_vector);
+                __internal::__brick_copy(__b, __e, __result + (__b - __middle), __is_vector);
             }
             else
             {
                 _OutputIterator __new_result = __result + ((__last - __middle) + (__b - __first));
                 if (__e < __middle)
                 {
-                    __brick_copy(__b, __e, __new_result, __is_vector);
+                    __internal::__brick_copy(__b, __e, __new_result, __is_vector);
                 }
                 else
                 {
-                    __brick_copy(__b, __middle, __new_result, __is_vector);
-                    __brick_copy(__middle, __e, __result, __is_vector);
+                    __internal::__brick_copy(__b, __middle, __new_result, __is_vector);
+                    __internal::__brick_copy(__middle, __e, __result, __is_vector);
                 }
             }
         });
@@ -1697,7 +1698,7 @@ bool
 __pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
                          _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_is_partitioned(__first, __last, __pred, __is_vector);
+    return __internal::__brick_is_partitioned(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1712,7 +1713,7 @@ __pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
     }
     else
     {
-        return __except_handler([&]() {
+        return __internal::__except_handler([&]() {
             // State of current range:
             // broken     - current range is not partitioned by pred
             // all_true   - all elements in current range satisfy pred
@@ -1748,12 +1749,11 @@ __pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
                     {
                         // find first element that don't satisfy pred
                         _ForwardIterator __x =
-                            __brick_find_if(__i + 1, __j, __not_pred<_UnaryPredicate>(__pred), __is_vector);
-
+                            __internal::__brick_find_if(__i + 1, __j, __not_pred<_UnaryPredicate>(__pred), __is_vector);
                         if (__x != __j)
                         {
                             // find first element after "x" that satisfy pred
-                            _ForwardIterator __y = __brick_find_if(__x + 1, __j, __pred, __is_vector);
+                            _ForwardIterator __y = __internal::__brick_find_if(__x + 1, __j, __pred, __is_vector);
                             // if it was found then range isn't partitioned by pred
                             if (__y != __j)
                             {
@@ -1773,7 +1773,7 @@ __pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
                     { // if first element doesn't satisfy pred
                         // then we should find the first element that satisfy pred.
                         // If we found it then range isn't partitioned by pred
-                        if (__brick_find_if(__i + 1, __j, __pred, __is_vector) != __j)
+                        if (__internal::__brick_find_if(__i + 1, __j, __pred, __is_vector) != __j)
                         {
                             return __broken;
                         }
@@ -1826,7 +1826,7 @@ _ForwardIterator
 __pattern_partition(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
                     _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_partition(__first, __last, __pred, __is_vector);
+    return __internal::__brick_partition(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1845,7 +1845,7 @@ __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
         _ForwardIterator __end;
     };
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         _PartitionRange __init{__last, __last, __last};
 
         // lambda for merging two partitioned ranges to one partitioned range
@@ -1866,7 +1866,7 @@ __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) {
-                        __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};
             }
@@ -1876,7 +1876,7 @@ __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
                 __par_backend::__parallel_for(
                     std::forward<_ExecutionPolicy>(__exec), __val1.__pivot, __val1.__pivot + __size2,
                     [__val1, __val2, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
-                        __brick_swap_ranges(__i, __j, __val2.__begin + (__i - __val1.__pivot), __is_vector);
+                        __internal::__brick_swap_ranges(__i, __j, __val2.__begin + (__i - __val1.__pivot), __is_vector);
                     });
                 return {__new_begin, __val1.__pivot + __size2, __val2.__end};
             }
@@ -1887,7 +1887,7 @@ __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
             [__pred, __is_vector, __reductor](_ForwardIterator __i, _ForwardIterator __j,
                                               _PartitionRange __value) -> _PartitionRange {
                 //1. serial partition
-                _ForwardIterator __pivot = __brick_partition(__i, __j, __pred, __is_vector);
+                _ForwardIterator __pivot = __internal::__brick_partition(__i, __j, __pred, __is_vector);
 
                 // 2. merging of two ranges (left and right respectively)
                 return __reductor(__value, {__i, __pivot, __j});
@@ -1925,7 +1925,7 @@ __pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator __first, _
                            _UnaryPredicate __pred, _IsVector __is_vector,
                            /*is_parallelization=*/std::false_type) noexcept
 {
-    return __brick_stable_partition(__first, __last, __pred, __is_vector);
+    return __internal::__brick_stable_partition(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -1944,7 +1944,7 @@ __pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __f
         _BidirectionalIterator __end;
     };
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         _PartitionRange __init{__last, __last, __last};
 
         // lambda for merging two partitioned ranges to one partitioned range
@@ -1961,7 +1961,7 @@ __pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __f
             // then we should swap the false part of left range and last part of true part of right range
             else
             {
-                __brick_rotate(__val1.__pivot, __val2.__begin, __val2.__pivot, __is_vector);
+                __internal::__brick_rotate(__val1.__pivot, __val2.__begin, __val2.__pivot, __is_vector);
                 return {__new_begin, __val2.__pivot - __size1, __val2.__end};
             }
         };
@@ -1971,7 +1971,7 @@ __pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __f
             [&__pred, __is_vector, __reductor](_BidirectionalIterator __i, _BidirectionalIterator __j,
                                                _PartitionRange __value) -> _PartitionRange {
                 //1. serial stable_partition
-                _BidirectionalIterator __pivot = __brick_stable_partition(__i, __j, __pred, __is_vector);
+                _BidirectionalIterator __pivot = __internal::__brick_stable_partition(__i, __j, __pred, __is_vector);
 
                 // 2. merging of two ranges (left and right respectively)
                 return __reductor(__value, {__i, __pivot, __j});
@@ -2013,7 +2013,7 @@ __pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI
                          _OutputIterator1 __out_true, _OutputIterator2 __out_false, _UnaryPredicate __pred,
                          _IsVector __is_vector, /*is_parallelization=*/std::false_type) noexcept
 {
-    return __brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
+    return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2030,20 +2030,20 @@ __pattern_partition_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs
     if (_DifferenceType(1) < __n)
     {
         __par_backend::__buffer<bool> __mask_buf(__n);
-        return __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 __brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
+                    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
-                    __brick_partition_by_mask(__first + __i, __first + (__i + __len), __out_true + __initial.first,
+                    __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; });
@@ -2051,7 +2051,7 @@ __pattern_partition_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs
         });
     }
     // trivial sequence - use serial algorithm
-    return __brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
+    return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
 }
 #endif
 
@@ -2074,7 +2074,7 @@ void
 __pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
                _IsVector /*is_vector*/, /*is_parallel=*/std::true_type, /*is_move_constructible=*/std::true_type)
 {
-    __except_handler([&]() {
+    __internal::__except_handler([&]() {
         __par_backend::__parallel_stable_sort(std::forward<_ExecutionPolicy>(__exec), __first, __last, __comp,
                                               [](_RandomAccessIterator __first, _RandomAccessIterator __last,
                                                  _Compare __comp) { std::sort(__first, __last, __comp); },
@@ -2101,7 +2101,7 @@ void
 __pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last,
                       _Compare __comp, _IsVector /*is_vector*/, /*is_parallel=*/std::true_type)
 {
-    __except_handler([&]() {
+    __internal::__except_handler([&]() {
         __par_backend::__parallel_stable_sort(std::forward<_ExecutionPolicy>(__exec), __first, __last, __comp,
                                               [](_RandomAccessIterator __first, _RandomAccessIterator __last,
                                                  _Compare __comp) { std::stable_sort(__first, __last, __comp); });
@@ -2129,7 +2129,7 @@ __pattern_partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
                        _RandomAccessIterator __last, _Compare __comp, _IsVector, /*is_parallel=*/std::true_type)
 {
     const auto __n = __middle - __first;
-    __except_handler([&]() {
+    __internal::__except_handler([&]() {
         __par_backend::__parallel_stable_sort(
             std::forward<_ExecutionPolicy>(__exec), __first, __last, __comp,
             [__n](_RandomAccessIterator __begin, _RandomAccessIterator __end, _Compare __comp) {
@@ -2169,7 +2169,7 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first,
     }
     auto __n1 = __last - __first;
     auto __n2 = __d_last - __d_first;
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         if (__n2 >= __n1)
         {
             __par_backend::__parallel_stable_sort(
@@ -2181,7 +2181,7 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first,
 
                 // 1. Copy elements from input to output
 #if !__PSTL_ICC_18_OMP_SIMD_BROKEN
-                    __brick_copy(__i1, __j1, __i, __is_vector);
+                    __internal::__brick_copy(__i1, __j1, __i, __is_vector);
 #else
                     std::copy(__i1, __j1, __i);
 #endif
@@ -2219,7 +2219,7 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first,
             // 3. Move elements from temporary __buffer to output
             __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __r, __r + __n2,
                                           [__r, __d_first, __is_vector](_T1* __i, _T1* __j) {
-                                              __brick_move(__i, __j, __d_first + (__i - __r), __is_vector);
+                                              __internal::__brick_move(__i, __j, __d_first + (__i - __r), __is_vector);
                                           });
             return __d_first + __n2;
         }
@@ -2251,7 +2251,7 @@ _ForwardIterator
 __pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred,
                         /* is_parallel */ std::false_type, _IsVector __is_vector, bool __or_semantic) noexcept
 {
-    return __brick_adjacent_find(__first, __last, __pred, __is_vector, __or_semantic);
+    return __internal::__brick_adjacent_find(__first, __last, __pred, __is_vector, __or_semantic);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2264,7 +2264,7 @@ __pattern_adjacent_find(_ExecutionPolicy&& __exec, _RandomAccessIterator __first
     if (__last - __first < 2)
         return __last;
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         return __par_backend::__parallel_reduce(
             std::forward<_ExecutionPolicy>(__exec), __first, __last, __last,
             [__last, __pred, __is_vector, __or_semantic](_RandomAccessIterator __begin, _RandomAccessIterator __end,
@@ -2288,7 +2288,7 @@ __pattern_adjacent_find(_ExecutionPolicy&& __exec, _RandomAccessIterator __first
 
                     //correct the global result iterator if the "brick" returns a local "__last"
                     const _RandomAccessIterator __res =
-                        __brick_adjacent_find(__begin, __end, __pred, __is_vector, __or_semantic);
+                        __internal::__brick_adjacent_find(__begin, __end, __pred, __is_vector, __or_semantic);
                     if (__res < __end)
                         __value = __res;
                 }
@@ -2332,7 +2332,7 @@ __pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
     _RandomAccessIterator __x;
     do
     {
-        __x = __pattern_partition(std::forward<_ExecutionPolicy>(__exec), __first + 1, __last,
+        __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());
         --__x;
@@ -2387,7 +2387,7 @@ void
 __pattern_fill(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value,
                /*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
 {
-    __brick_fill(__first, __last, __value, __is_vector);
+    __internal::__brick_fill(__first, __last, __value, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2396,10 +2396,10 @@ _ForwardIterator
 __pattern_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value,
                /*is_parallel=*/std::true_type, _IsVector __is_vector)
 {
-    return __except_handler([&__exec, __first, __last, &__value, __is_vector]() {
+    return __internal::__except_handler([&__exec, __first, __last, &__value, __is_vector]() {
         __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                                       [&__value, __is_vector](_ForwardIterator __begin, _ForwardIterator __end) {
-                                          __brick_fill(__begin, __end, __value, __is_vector);
+                                          __internal::__brick_fill(__begin, __end, __value, __is_vector);
                                       });
         return __last;
     });
@@ -2425,7 +2425,7 @@ _OutputIterator
 __pattern_fill_n(_ExecutionPolicy&&, _OutputIterator __first, _Size __count, const _Tp& __value,
                  /*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
 {
-    return __brick_fill_n(__first, __count, __value, __is_vector);
+    return __internal::__brick_fill_n(__first, __count, __value, __is_vector);
 }
 
 template <class _ExecutionPolicy, class _OutputIterator, class _Size, class _Tp, class _IsVector>
@@ -2433,7 +2433,7 @@ _OutputIterator
 __pattern_fill_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size __count, const _Tp& __value,
                  /*is_parallel=*/std::true_type, _IsVector __is_vector)
 {
-    return __pattern_fill(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __value, std::true_type(),
+    return __internal::__pattern_fill(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __value, std::true_type(),
                           __is_vector);
 }
 
@@ -2461,7 +2461,7 @@ void
 __pattern_generate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Generator __g,
                    /*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
 {
-    __brick_generate(__first, __last, __g, __is_vector);
+    __internal::__brick_generate(__first, __last, __g, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2470,10 +2470,10 @@ _ForwardIterator
 __pattern_generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g,
                    /*is_parallel=*/std::true_type, _IsVector __is_vector)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                                       [__g, __is_vector](_ForwardIterator __begin, _ForwardIterator __end) {
-                                          __brick_generate(__begin, __end, __g, __is_vector);
+                                          __internal::__brick_generate(__begin, __end, __g, __is_vector);
                                       });
         return __last;
     });
@@ -2499,7 +2499,7 @@ _OutputIterator
 __pattern_generate_n(_ExecutionPolicy&&, _OutputIterator __first, _Size __count, _Generator __g,
                      /*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
 {
-    return __brick_generate_n(__first, __count, __g, __is_vector);
+    return __internal::__brick_generate_n(__first, __count, __g, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2510,7 +2510,7 @@ __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 __pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(),
+    return __internal::__pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(),
                               __is_vector);
 }
 #endif
@@ -2544,7 +2544,7 @@ _ForwardIterator
 __pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
                     _IsVector __is_vector, /*is_parallel*/ std::false_type) noexcept
 {
-    return __brick_remove_if(__first, __last, __pred, __is_vector);
+    return __internal::__brick_remove_if(__first, __last, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2558,12 +2558,12 @@ __pattern_remove_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar
     if (__first == __last || __first + 1 == __last)
     {
         // Trivial sequence - use serial algorithm
-        return __brick_remove_if(__first, __last, __pred, __is_vector);
+        return __internal::__brick_remove_if(__first, __last, __pred, __is_vector);
     }
 
-    return remove_elements(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+    return __internal::__remove_elements(std::forward<_ExecutionPolicy>(__exec), __first, __last,
                            [&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
-                               __brick_walk2(__b, __e, __it,
+                               __internal::__brick_walk2(__b, __e, __it,
                                              [&__pred](bool& __x, _ReferenceType __y) { __x = !__pred(__y); },
                                              __is_vector);
                            },
@@ -2601,7 +2601,7 @@ __pattern_merge(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator
                 _ForwardIterator2 __last2, _OutputIterator __d_first, _Compare __comp, _IsVector __is_vector,
                 /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector);
+    return __internal::__brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2616,7 +2616,7 @@ __pattern_merge(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran
         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 __brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector); });
+                      _Compare __comp) { return __internal::__brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector); });
     return __d_first + (__last1 - __first1) + (__last2 - __first2);
 }
 #endif
@@ -2647,7 +2647,7 @@ __pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bid
                         _BidirectionalIterator __last, _Compare __comp, _IsVector __is_vector,
                         /* is_parallel = */ std::false_type) noexcept
 {
-    __brick_inplace_merge(__first, __middle, __last, __comp, __is_vector);
+    __internal::__brick_inplace_merge(__first, __middle, __last, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -2665,14 +2665,14 @@ __pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __firs
     auto __n = __last - __first;
     __par_backend::__buffer<_Tp> __buf(__n);
     _Tp* __r = __buf.get();
-    __except_handler([&]() {
+    __internal::__except_handler([&]() {
         auto __move_values = [](_BidirectionalIterator __x, _Tp* __z) {
-            __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) {
-            return __brick_uninitialized_move(__first1, __last1, __first2, _IsVector());
+            return __internal::__brick_uninitialized_move(__first1, __last1, __first2, _IsVector());
         };
 
         __par_backend::__parallel_merge(
@@ -2685,9 +2685,10 @@ __pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __firs
                 __func(__f1, __l1, __f2, __l2, __f3, __comp);
                 return __f3 + (__l1 - __f1) + (__l2 - __f2);
             });
+
         __par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __r, __r + __n,
                                       [__r, __first, __is_vector](_Tp* __i, _Tp* __j) {
-                                          __brick_move(__i, __j, __first + (__i - __r), __is_vector);
+                                          __internal::__brick_move(__i, __j, __first + (__i - __r), __is_vector);
                                       });
     });
 }
@@ -2726,8 +2727,8 @@ __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwa
     if (__last2 - __first2 == 1)
         return !__comp(*__first1, *__first2) && !__comp(*__first2, *__first1);
 
-    return __except_handler([&]() {
-        return !__parallel_or(
+    return __internal::__except_handler([&]() {
+         return !__internal::__parallel_or(
             std::forward<_ExecutionPolicy>(__exec), __first2, __last2,
             [__first1, __last1, __first2, __last2, &__comp](_ForwardIterator2 __i, _ForwardIterator2 __j) {
                 assert(__j > __i);
@@ -2791,13 +2792,13 @@ __parallel_set_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwar
 
     __par_backend::__buffer<_T> __buf(__size_func(__n1, __n2));
 
-    return __except_handler([&__exec, __n1, __first1, __last1, __first2, __last2, __result, __is_vector, __comp,
+    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())
-                __brick_move(__buffer + __s.__buf_pos, __buffer + (__s.__buf_pos + __s.__len), __result + __s.__pos,
+                __internal::__brick_move(__buffer + __s.__buf_pos, __buffer + (__s.__buf_pos + __s.__len), __result + __s.__pos,
                              __is_vector);
         };
         __par_backend::parallel_strict_scan(
@@ -2871,35 +2872,35 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
     const auto __n2 = __last2 - __first2;
 
     auto copy_range1 = [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
-        return __brick_copy(__begin, __end, __res, __is_vector);
+        return __internal::__brick_copy(__begin, __end, __res, __is_vector);
     };
     auto copy_range2 = [__is_vector](_ForwardIterator2 __begin, _ForwardIterator2 __end, _OutputIterator __res) {
-        return __brick_copy(__begin, __end, __res, __is_vector);
+        return __internal::__brick_copy(__begin, __end, __res, __is_vector);
     };
 
     // {1} {}: parallel copying just first sequence
     if (__n2 == 0)
-        return __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result, copy_range1,
+        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 __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2, __result, copy_range2,
+        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 = lower_bound(__first1, __last1, *__first2, __comp);
+    _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
 
     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),
                                          [=] {
-                                             __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
+                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
                                                                    __last1, __result, copy_range1, std::true_type());
                                          },
                                          [=] {
-                                             __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
+                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
                                                                    __last2, __result + __n1, copy_range2,
                                                                    std::true_type());
                                          });
@@ -2907,18 +2908,18 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
     }
 
     // testing  whether the sequences are intersected
-    _ForwardIterator2 __left_bound_seq_2 = lower_bound(__first2, __last2, *__first1, __comp);
+    _ForwardIterator2 __left_bound_seq_2 = std::lower_bound(__first2, __last2, *__first1, __comp);
 
     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),
                                          [=] {
-                                             __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
+                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
                                                                    __last2, __result, copy_range2, std::true_type());
                                          },
                                          [=] {
-                                             __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
+                                             __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
                                                                    __last1, __result + __n2, copy_range1,
                                                                    std::true_type());
                                          });
@@ -2934,11 +2935,11 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
             std::forward<_ExecutionPolicy>(__exec),
             //do parallel copying of [first1; left_bound_seq_1)
             [=] {
-                __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __left_bound_seq_1, __res_or,
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __left_bound_seq_1, __res_or,
                                       copy_range1, std::true_type());
             },
             [=, &__result] {
-                __result = __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1,
+                __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);
@@ -2956,11 +2957,11 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
             std::forward<_ExecutionPolicy>(__exec),
             //do parallel copying of [first2; left_bound_seq_2)
             [=] {
-                __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __left_bound_seq_2, __res_or,
+                __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __left_bound_seq_2, __res_or,
                                       copy_range2, std::true_type());
             },
             [=, &__result] {
-                __result = __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
+                __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);
@@ -2968,7 +2969,7 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
         return __result;
     }
 
-    return __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __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);
 }
@@ -3005,7 +3006,7 @@ __pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIter
                     _IsVector __is_vector,
                     /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+    return __internal::__brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3025,7 +3026,7 @@ __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 __parallel_set_union_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
+    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) {
@@ -3065,7 +3066,7 @@ __pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forw
                            _ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
                            _Compare __comp, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+    return __internal::__brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3087,13 +3088,13 @@ __pattern_set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1
         return __result;
 
     // testing  whether the sequences are intersected
-    _ForwardIterator1 __left_bound_seq_1 = lower_bound(__first1, __last1, *__first2, __comp);
+    _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
     //{1} < {2}: seq 2 is wholly greater than seq 1, so, the intersection is empty
     if (__left_bound_seq_1 == __last1)
         return __result;
 
     // testing  whether the sequences are intersected
-    _ForwardIterator2 __left_bound_seq_2 = lower_bound(__first2, __last2, *__first1, __comp);
+    _ForwardIterator2 __left_bound_seq_2 = std::lower_bound(__first2, __last2, *__first1, __comp);
     //{2} < {1}: seq 1 is wholly greater than seq 2, so, the intersection is empty
     if (__left_bound_seq_2 == __last2)
         return __result;
@@ -3102,7 +3103,7 @@ __pattern_set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1
     if (__m1 > __set_algo_cut_off)
     {
         //we know proper offset due to [first1; left_bound_seq_1) < [first2; last2)
-        return __parallel_set_op(
+        return __internal::__parallel_set_op(
             std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1, __first2, __last2, __result, __comp,
             [](_DifferenceType __n, _DifferenceType __m) { return std::min(__n, __m); },
             [](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
@@ -3116,7 +3117,7 @@ __pattern_set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1
     if (__m2 > __set_algo_cut_off)
     {
         //we know proper offset due to [first2; left_bound_seq_2) < [first1; last1)
-        __result = __parallel_set_op(
+        __result = __internal::__parallel_set_op(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __left_bound_seq_2, __last2, __result, __comp,
             [](_DifferenceType __n, _DifferenceType __m) { return std::min(__n, __m); },
             [](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
@@ -3162,7 +3163,7 @@ __pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forwar
                          _ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
                          _Compare __comp, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+    return __internal::__brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3185,37 +3186,37 @@ __pattern_set_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1,
 
     // {1} \ {}: parallel copying just first sequence
     if (__n2 == 0)
-        return __pattern_walk2_brick(
+        return __internal::__pattern_walk2_brick(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
             [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
-                return __brick_copy(__begin, __end, __res, __is_vector);
+                return __internal::__brick_copy(__begin, __end, __res, __is_vector);
             },
             std::true_type());
 
     // testing  whether the sequences are intersected
-    _ForwardIterator1 __left_bound_seq_1 = lower_bound(__first1, __last1, *__first2, __comp);
+    _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
     //{1} < {2}: seq 2 is wholly greater than seq 1, so, parallel copying just first sequence
     if (__left_bound_seq_1 == __last1)
-        return __pattern_walk2_brick(
+        return __internal::__pattern_walk2_brick(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
             [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
-                return __brick_copy(__begin, __end, __res, __is_vector);
+                return __internal::__brick_copy(__begin, __end, __res, __is_vector);
             },
             std::true_type());
 
     // testing  whether the sequences are intersected
-    _ForwardIterator2 __left_bound_seq_2 = lower_bound(__first2, __last2, *__first1, __comp);
+    _ForwardIterator2 __left_bound_seq_2 = std::lower_bound(__first2, __last2, *__first1, __comp);
     //{2} < {1}: seq 1 is wholly greater than seq 2, so, parallel copying just first sequence
     if (__left_bound_seq_2 == __last2)
-        return __pattern_walk2_brick(
+        return __internal::__pattern_walk2_brick(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
             [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
-                return __brick_copy(__begin, __end, __res, __is_vector);
+                return __internal::__brick_copy(__begin, __end, __res, __is_vector);
             },
             std::true_type());
 
     if (__n1 + __n2 > __set_algo_cut_off)
-        return __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
+        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) {
@@ -3258,7 +3259,7 @@ __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 __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
@@ -3278,7 +3279,7 @@ __pattern_set_symmetric_difference(_ExecutionPolicy&& __exec, _ForwardIterator1
         return std::set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
 
     typedef typename std::iterator_traits<_OutputIterator>::value_type _T;
-    return __parallel_set_union_op(
+    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) {
@@ -3318,7 +3319,7 @@ _RandomAccessIterator
 __pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator __first, _RandomAccessIterator __last,
                         _Compare __comp, _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_is_heap_until(__first, __last, __comp, __is_vector);
+    return __internal::__brick_is_heap_until(__first, __last, __comp, __is_vector);
 }
 
 template <class _RandomAccessIterator, class _DifferenceType, class _Compare>
@@ -3356,11 +3357,11 @@ __pattern_is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first
     if (__last - __first < 2)
         return __last;
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         return __parallel_find(
             std::forward<_ExecutionPolicy>(__exec), __first, __last,
             [__first, __comp, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j) {
-                return __is_heap_until_local(__first, __i - __first, __j - __first, __comp, __is_vector);
+                return __internal::__is_heap_until_local(__first, __i - __first, __j - __first, __comp, __is_vector);
             },
             std::less<typename std::iterator_traits<_RandomAccessIterator>::difference_type>(), /*is_first=*/true);
     });
@@ -3396,7 +3397,7 @@ _ForwardIterator
 __pattern_min_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
                       _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_min_element(__first, __last, __comp, __is_vector);
+    return __internal::__brick_min_element(__first, __last, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3408,16 +3409,16 @@ __pattern_min_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
     if (__first == __last)
         return __last;
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         return __par_backend::__parallel_reduce(
             std::forward<_ExecutionPolicy>(__exec), __first + 1, __last, __first,
             [=](_RandomAccessIterator __begin, _RandomAccessIterator __end,
                 _RandomAccessIterator __init) -> _RandomAccessIterator {
-                const _RandomAccessIterator subresult = __brick_min_element(__begin, __end, __comp, __is_vector);
-                return __cmp_iterators_by_values(__init, subresult, __comp);
+                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 {
-                return __cmp_iterators_by_values(__it1, __it2, __comp);
+                return __internal::__cmp_iterators_by_values(__it1, __it2, __comp);
             });
     });
 }
@@ -3452,7 +3453,7 @@ std::pair<_ForwardIterator, _ForwardIterator>
 __pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
                          _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_minmax_element(__first, __last, __comp, __is_vector);
+    return __internal::__brick_minmax_element(__first, __last, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3464,21 +3465,21 @@ __pattern_minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F
     if (__first == __last)
         return std::make_pair(__first, __first);
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         typedef std::pair<_ForwardIterator, _ForwardIterator> _Result;
 
         return __par_backend::__parallel_reduce(
             std::forward<_ExecutionPolicy>(__exec), __first + 1, __last, std::make_pair(__first, __first),
             [=](_ForwardIterator __begin, _ForwardIterator __end, _Result __init) -> _Result {
-                const _Result __subresult = __brick_minmax_element(__begin, __end, __comp, __is_vector);
+                const _Result __subresult = __internal::__brick_minmax_element(__begin, __end, __comp, __is_vector);
                 return std::make_pair(
-                    __cmp_iterators_by_values(__subresult.first, __init.first, __comp),
-                    __cmp_iterators_by_values(__init.second, __subresult.second, __not_pred<_Compare>(__comp)));
+                    __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(
-                    __cmp_iterators_by_values(__p1.first, __p2.first, __comp),
-                    __cmp_iterators_by_values(__p2.second, __p1.second, __not_pred<_Compare>(__comp)));
+                    __internal::__cmp_iterators_by_values(__p1.first, __p2.first, __comp),
+                    __internal::__cmp_iterators_by_values(__p2.second, __p1.second, __not_pred<_Compare>(__comp)));
             });
     });
 }
@@ -3525,7 +3526,7 @@ __pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardItera
                    _ForwardIterator2 __first2, _ForwardIterator2 __last2, _Predicate __pred, _IsVector __is_vector,
                    /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector);
+    return __internal::__brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3536,12 +3537,12 @@ __pattern_mismatch(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _
                    _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _Predicate __pred,
                    _IsVector __is_vector, /* is_parallel = */ std::true_type) noexcept
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         auto __n = std::min(__last1 - __first1, __last2 - __first2);
-        auto __result = __parallel_find(
+        auto __result = __internal::__parallel_find(
             std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
             [__first1, __first2, __pred, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
-                return __brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1), __pred,
+                return __internal::__brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1), __pred,
                                         __is_vector)
                     .first;
             },
@@ -3606,7 +3607,7 @@ __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1 __first1
                                   _ForwardIterator2 __first2, _ForwardIterator2 __last2, _Compare __comp,
                                   _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
 {
-    return __brick_lexicographical_compare(__first1, __last1, __first2, __last2, __comp, __is_vector);
+    return __internal::__brick_lexicographical_compare(__first1, __last1, __first2, __last2, __comp, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -3631,10 +3632,10 @@ __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 _
         --__last1;
         --__last2;
         auto __n = std::min(__last1 - __first1, __last2 - __first2);
-        auto __result = __parallel_find(
+        auto __result = __internal::__parallel_find(
             std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
             [__first1, __first2, &__comp, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
-                return __brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1),
+                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);
                                         },
index be8a4a321d3db96cc284c42cf8ae0ac53aae28fa..9a4b49bd46a15156624307d0131c01fca3354ac0 100644 (file)
@@ -123,27 +123,27 @@ struct is_execution_policy : std::false_type
 };
 
 template <>
-struct is_execution_policy<sequenced_policy> : std::true_type
+struct is_execution_policy<__pstl::execution::sequenced_policy> : std::true_type
 {
 };
 #if __PSTL_USE_PAR_POLICIES
 template <>
-struct is_execution_policy<parallel_policy> : std::true_type
+struct is_execution_policy<__pstl::execution::parallel_policy> : std::true_type
 {
 };
 template <>
-struct is_execution_policy<parallel_unsequenced_policy> : std::true_type
+struct is_execution_policy<__pstl::execution::parallel_unsequenced_policy> : std::true_type
 {
 };
 #endif
 template <>
-struct is_execution_policy<unsequenced_policy> : std::true_type
+struct is_execution_policy<__pstl::execution::unsequenced_policy> : std::true_type
 {
 };
 
 #if __PSTL_CPP14_VARIABLE_TEMPLATES_PRESENT
 template <class T>
-constexpr bool is_execution_policy_v = is_execution_policy<T>::value;
+constexpr bool is_execution_policy_v = __pstl::execution::is_execution_policy<T>::value;
 #endif
 
 } // namespace v1
index f33e6fc849bc46023e9e1383b26b7f2962e36cf3..8ee5fa062a8716b441e92b960a6d695be294cca3 100644 (file)
@@ -55,7 +55,7 @@ template <typename _IteratorType, typename... _OtherIteratorTypes>
 struct __is_random_access_iterator
 {
     static constexpr bool value =
-        __is_random_access_iterator<_IteratorType>::value && __is_random_access_iterator<_OtherIteratorTypes...>::value;
+      __internal::__is_random_access_iterator<_IteratorType>::value && __internal::__is_random_access_iterator<_OtherIteratorTypes...>::value;
     typedef std::integral_constant<bool, value> type;
 };
 
@@ -106,38 +106,38 @@ struct __policy_traits<parallel_unsequenced_policy>
 #endif
 
 template <typename _ExecutionPolicy>
-using __collector_t = typename __policy_traits<typename std::decay<_ExecutionPolicy>::type>::__collector_type;
+using __collector_t = typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__collector_type;
 
 template <typename _ExecutionPolicy>
-using __allow_vector = typename __policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_vector;
+using __allow_vector = typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_vector;
 
 template <typename _ExecutionPolicy>
-using __allow_unsequenced = typename __policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_unsequenced;
+using __allow_unsequenced = typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_unsequenced;
 
 template <typename _ExecutionPolicy>
-using __allow_parallel = typename __policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_parallel;
+using __allow_parallel = typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_parallel;
 
 template <typename _ExecutionPolicy, typename... _IteratorTypes>
 auto
 __is_vectorization_preferred(_ExecutionPolicy&& __exec)
-    -> decltype(__lazy_and(__exec.__allow_vector(), typename __is_random_access_iterator<_IteratorTypes...>::type()))
+    -> decltype(__internal::__lazy_and(__exec.__allow_vector(), typename __internal::__is_random_access_iterator<_IteratorTypes...>::type()))
 {
-    return __lazy_and(__exec.__allow_vector(), typename __is_random_access_iterator<_IteratorTypes...>::type());
+    return __internal::__lazy_and(__exec.__allow_vector(), typename __internal::__is_random_access_iterator<_IteratorTypes...>::type());
 }
 
 template <typename _ExecutionPolicy, typename... _IteratorTypes>
 auto
 __is_parallelization_preferred(_ExecutionPolicy&& __exec)
-    -> decltype(__lazy_and(__exec.__allow_parallel(), typename __is_random_access_iterator<_IteratorTypes...>::type()))
+    -> decltype(__internal::__lazy_and(__exec.__allow_parallel(), typename __internal::__is_random_access_iterator<_IteratorTypes...>::type()))
 {
-    return __lazy_and(__exec.__allow_parallel(), typename __is_random_access_iterator<_IteratorTypes...>::type());
+    return __internal::__lazy_and(__exec.__allow_parallel(), typename __internal::__is_random_access_iterator<_IteratorTypes...>::type());
 }
 
 template <typename policy, typename... _IteratorTypes>
 struct __prefer_unsequenced_tag
 {
     static constexpr bool value =
-        __allow_unsequenced<policy>::value && __is_random_access_iterator<_IteratorTypes...>::value;
+        __internal::__allow_unsequenced<policy>::value && __internal::__is_random_access_iterator<_IteratorTypes...>::value;
     typedef std::integral_constant<bool, value> type;
 };
 
@@ -145,7 +145,7 @@ template <typename policy, typename... _IteratorTypes>
 struct __prefer_parallel_tag
 {
     static constexpr bool value =
-        __allow_parallel<policy>::value && __is_random_access_iterator<_IteratorTypes...>::value;
+        __internal::__allow_parallel<policy>::value && __internal::__is_random_access_iterator<_IteratorTypes...>::value;
     typedef std::integral_constant<bool, value> type;
 };
 
index 803e2d8bf6148b1b42837076b4550322b5db5452..49a4abf5a95c879b4e454ef5d7367f869b485038 100644 (file)
@@ -71,7 +71,7 @@ __pattern_transform_reduce(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __f
                            _RandomAccessIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1,
                            _BinaryOperation2 __binary_op2, _IsVector __is_vector, /*is_parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         return __par_backend::__parallel_transform_reduce(
             std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
             [__first1, __first2, __binary_op2](_RandomAccessIterator1 __i) mutable {
@@ -81,7 +81,7 @@ __pattern_transform_reduce(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __f
             __binary_op1, // Combine
             [__first1, __first2, __binary_op1, __binary_op2,
              __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j, _Tp __init) -> _Tp {
-                return __brick_transform_reduce(__i, __j, __first2 + (__i - __first1), __init, __binary_op1,
+                return __internal::__brick_transform_reduce(__i, __j, __first2 + (__i - __first1), __init, __binary_op1,
                                                 __binary_op2, __is_vector);
             });
     });
@@ -122,7 +122,7 @@ __pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator __first, _Forwar
                            _BinaryOperation __binary_op, _UnaryOperation __unary_op, _IsVector __is_vector,
                            /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_transform_reduce(__first, __last, __init, __binary_op, __unary_op, __is_vector);
+    return __internal::__brick_transform_reduce(__first, __last, __init, __binary_op, __unary_op, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -133,12 +133,12 @@ __pattern_transform_reduce(_ExecutionPolicy&& __exec, _ForwardIterator __first,
                            _BinaryOperation __binary_op, _UnaryOperation __unary_op, _IsVector __is_vector,
                            /*is_parallel=*/std::true_type)
 {
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         return __par_backend::__parallel_transform_reduce(
             std::forward<_ExecutionPolicy>(__exec), __first, __last,
             [__unary_op](_ForwardIterator __i) mutable { return __unary_op(*__i); }, __init, __binary_op,
             [__unary_op, __binary_op, __is_vector](_ForwardIterator __i, _ForwardIterator __j, _Tp __init) {
-                return __brick_transform_reduce(__i, __j, __init, __binary_op, __unary_op, __is_vector);
+                return __internal::__brick_transform_reduce(__i, __j, __init, __binary_op, __unary_op, __is_vector);
             });
     });
 }
@@ -201,7 +201,7 @@ __brick_transform_scan(_ForwardIterator __first, _ForwardIterator __last, _Outpu
                                         _Inclusive());
 #else
     // We need to call serial brick here to call function for inclusive and exclusive scan that depends on _Inclusive() value
-    return __brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(),
+    return __internal::__brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(),
                                   /*is_vector=*/std::false_type());
 #endif
 }
@@ -213,7 +213,7 @@ __brick_transform_scan(_ForwardIterator __first, _ForwardIterator __last, _Outpu
                        _UnaryOperation __unary_op, _Tp __init, _BinaryOperation __binary_op, _Inclusive,
                        /*is_vector=*/std::true_type) noexcept
 {
-    return __brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(),
+    return __internal::__brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(),
                                   /*is_vector=*/std::false_type());
 }
 
@@ -224,7 +224,7 @@ __pattern_transform_scan(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI
                          _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, _BinaryOperation __binary_op,
                          _Inclusive, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
 {
-    return __brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(), __is_vector)
+    return __internal::__brick_transform_scan(__first, __last, __result, __unary_op, __init, __binary_op, _Inclusive(), __is_vector)
         .first;
 }
 
@@ -238,19 +238,19 @@ __pattern_transform_scan(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs
 {
     typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type _DifferenceType;
 
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::__parallel_transform_scan(
             std::forward<_ExecutionPolicy>(__exec), __last - __first,
             [__first, __unary_op](_DifferenceType __i) mutable { return __unary_op(__first[__i]); }, __init,
             __binary_op,
             [__first, __unary_op, __binary_op](_DifferenceType __i, _DifferenceType __j, _Tp __init) {
                 // Execute serial __brick_transform_reduce, due to the explicit SIMD vectorization (reduction) requires a commutative operation for the guarantee of correct scan.
-                return __brick_transform_reduce(__first + __i, __first + __j, __init, __binary_op, __unary_op,
+                return __internal::__brick_transform_reduce(__first + __i, __first + __j, __init, __binary_op, __unary_op,
                                                 /*__is_vector*/ std::false_type());
             },
             [__first, __unary_op, __binary_op, __result, __is_vector](_DifferenceType __i, _DifferenceType __j,
                                                                       _Tp __init) {
-                return __brick_transform_scan(__first + __i, __first + __j, __result + __i, __unary_op, __init,
+                return __internal::__brick_transform_scan(__first + __i, __first + __j, __result + __i, __unary_op, __init,
                                               __binary_op, _Inclusive(), __is_vector)
                     .second;
             });
@@ -274,11 +274,11 @@ __pattern_transform_scan(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs
     {
         return __result;
     }
-    return __except_handler([&]() {
+    return __internal::__except_handler([&]() {
         __par_backend::parallel_strict_scan(
             std::forward<_ExecutionPolicy>(__exec), __n, __init,
             [__first, __unary_op, __binary_op, __result, __is_vector](_DifferenceType __i, _DifferenceType __len) {
-                return __brick_transform_scan(__first + __i, __first + (__i + __len), __result + __i, __unary_op, _Tp{},
+                return __internal::__brick_transform_scan(__first + __i, __first + (__i + __len), __result + __i, __unary_op, _Tp{},
                                               __binary_op, _Inclusive(), __is_vector)
                     .second;
             },
@@ -333,7 +333,7 @@ __pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator __first, _For
                               _OutputIterator __d_first, _BinaryOperation __op, _IsVector __is_vector,
                               /*is_parallel*/ std::false_type) noexcept
 {
-    return __brick_adjacent_difference(__first, __last, __d_first, __op, __is_vector);
+    return __internal::__brick_adjacent_difference(__first, __last, __d_first, __op, __is_vector);
 }
 
 #if __PSTL_USE_PAR_POLICIES
@@ -353,7 +353,7 @@ __pattern_adjacent_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __fir
         std::forward<_ExecutionPolicy>(__exec), __first, __last - 1,
         [&__op, __is_vector, __d_first, __first](_ForwardIterator1 __b, _ForwardIterator1 __e) {
             _ForwardIterator2 __d_b = __d_first + (__b - __first);
-            __brick_walk3(
+            __internal::__brick_walk3(
                 __b, __e, __b + 1, __d_b + 1,
                 [&__op](_ReferenceType1 __x, _ReferenceType1 __y, _ReferenceType2 __z) { __z = __op(__y, __x); },
                 __is_vector);
index 114bf6397101c0cbf9004eadc28d3b0609298a5e..f09f47a8a8923d146a42745075f9baf4e0e27956 100644 (file)
@@ -190,7 +190,7 @@ _Tp
 __parallel_transform_reduce(_ExecutionPolicy&&, _Index __first, _Index __last, _Up __u, _Tp __init, _Cp __combine,
                             _Rp __brick_reduce)
 {
-    __par_trans_red_body<_Index, _Up, _Tp, _Cp, _Rp> __body(__u, __init, __combine, __brick_reduce);
+    __par_backend::__par_trans_red_body<_Index, _Up, _Tp, _Cp, _Rp> __body(__u, __init, __combine, __brick_reduce);
     // The grain size of 3 is used in order to provide mininum 2 elements for each body
     tbb::this_task_arena::isolate(
         [__first, __last, &__body]() { tbb::parallel_reduce(tbb::blocked_range<_Index>(__first, __last, 3), __body); });
@@ -234,7 +234,7 @@ class __trans_scan_body
     sum() const
     {
         __TBB_ASSERT(_M_has_sum, "sum expected");
-        return *(_Tp*)_M_sum_storage;
+        return *const_cast<_Tp*>(reinterpret_cast<_Tp const*>(_M_sum_storage));
     }
 
     void
@@ -304,8 +304,8 @@ __upsweep(_Index __i, _Index __m, _Index __tilesize, _Tp* __r, _Index __lastsize
     {
         _Index __k = __split(__m);
         tbb::parallel_invoke(
-            [=] { __upsweep(__i, __k, __tilesize, __r, __tilesize, __reduce, __combine); },
-            [=] { __upsweep(__i + __k, __m - __k, __tilesize, __r + __k, __lastsize, __reduce, __combine); });
+           [=] { __par_backend::__upsweep(__i, __k, __tilesize, __r, __tilesize, __reduce, __combine); },
+            [=] { __par_backend::__upsweep(__i + __k, __m - __k, __tilesize, __r + __k, __lastsize, __reduce, __combine); });
         if (__m == 2 * __k)
             __r[__m - 1] = __combine(__r[__k - 1], __r[__m - 1]);
     }
@@ -321,11 +321,11 @@ __downsweep(_Index __i, _Index __m, _Index __tilesize, _Tp* __r, _Index __lastsi
     else
     {
         const _Index __k = __split(__m);
-        tbb::parallel_invoke([=] { __downsweep(__i, __k, __tilesize, __r, __tilesize, __initial, __combine, __scan); },
+        tbb::parallel_invoke([=] { __par_backend::__downsweep(__i, __k, __tilesize, __r, __tilesize, __initial, __combine, __scan); },
                              // Assumes that __combine never throws.
                              //TODO: Consider adding a requirement for user functors to be constant.
                              [=, &__combine] {
-                                 __downsweep(__i + __k, __m - __k, __tilesize, __r + __k, __lastsize,
+                                 __par_backend::__downsweep(__i + __k, __m - __k, __tilesize, __r + __k, __lastsize,
                                              __combine(__initial, __r[__k - 1]), __combine, __scan);
                              });
     }
@@ -358,7 +358,8 @@ parallel_strict_scan(_ExecutionPolicy&&, _Index __n, _Tp __initial, _Rp __reduce
             _Index __m = (__n - 1) / __tilesize;
             __buffer<_Tp> __buf(__m + 1);
             _Tp* __r = __buf.get();
-            __upsweep(_Index(0), _Index(__m + 1), __tilesize, __r, __n - __m * __tilesize, __reduce, __combine);
+            __par_backend::__upsweep(_Index(0), _Index(__m + 1), __tilesize, __r, __n - __m * __tilesize, __reduce, __combine);
+
             // When __apex is a no-op and __combine has no side effects, a good optimizer
             // should be able to eliminate all code between here and __apex.
             // Alternatively, provide a default value for __apex that can be
@@ -368,7 +369,7 @@ parallel_strict_scan(_ExecutionPolicy&&, _Index __n, _Tp __initial, _Rp __reduce
             while ((__k &= __k - 1))
                 __t = __combine(__r[__k - 1], __t);
             __apex(__combine(__initial, __t));
-            __downsweep(_Index(0), _Index(__m + 1), __tilesize, __r, __n - __m * __tilesize, __initial, __combine,
+            __par_backend::__downsweep(_Index(0), _Index(__m + 1), __tilesize, __r, __n - __m * __tilesize, __initial, __combine,
                         __scan);
             return;
         }
@@ -522,7 +523,7 @@ __stable_sort_task<_RandomAccessIterator1, _RandomAccessIterator2, _Compare, _Le
     {
         _M_leaf_sort(_M_xs, _M_xe, _M_comp);
         if (_M_inplace != 2)
-            __init_buf(_M_xs, _M_xe, _M_zs, _M_inplace == 0);
+            __par_backend::__init_buf(_M_xs, _M_xe, _M_zs, _M_inplace == 0);
         return NULL;
     }
     else
@@ -535,19 +536,19 @@ __stable_sort_task<_RandomAccessIterator1, _RandomAccessIterator2, _Compare, _Le
         auto __move_sequences = [](_RandomAccessIterator2 __first1, _RandomAccessIterator2 __last1,
                                    _RandomAccessIterator1 __first2) { return std::move(__first1, __last1, __first2); };
         if (_M_inplace == 2)
-            __m = new (allocate_continuation())
+           __m = new (tbb::task::allocate_continuation())
                 __merge_task<_RandomAccessIterator2, _RandomAccessIterator2, _RandomAccessIterator1, _Compare,
                              __serial_destroy,
-                             __serial_move_merge<decltype(__move_values), decltype(__move_sequences)>>(
+                             __par_backend::__serial_move_merge<decltype(__move_values), decltype(__move_sequences)>>(
                     _M_zs, __zm, __zm, __ze, _M_xs, _M_comp, __serial_destroy(),
-                    __serial_move_merge<decltype(__move_values), decltype(__move_sequences)>(__nmerge, __move_values,
+                    __par_backend::__serial_move_merge<decltype(__move_values), decltype(__move_sequences)>(__nmerge, __move_values,
                                                                                              __move_sequences));
         else if (_M_inplace)
-            __m = new (allocate_continuation())
+            __m = new (tbb::task::allocate_continuation())
                 __merge_task<_RandomAccessIterator2, _RandomAccessIterator2, _RandomAccessIterator1, _Compare,
-                             __binary_no_op, __serial_move_merge<decltype(__move_values), decltype(__move_sequences)>>(
-                    _M_zs, __zm, __zm, __ze, _M_xs, _M_comp, __binary_no_op(),
-                    __serial_move_merge<decltype(__move_values), decltype(__move_sequences)>(__nmerge, __move_values,
+                             __par_backend::__binary_no_op, __par_backend::__serial_move_merge<decltype(__move_values), decltype(__move_sequences)>>(
+                    _M_zs, __zm, __zm, __ze, _M_xs, _M_comp, __par_backend::__binary_no_op(),
+                    __par_backend::__serial_move_merge<decltype(__move_values), decltype(__move_sequences)>(__nmerge, __move_values,
                                                                                              __move_sequences));
         else
         {
@@ -556,18 +557,18 @@ __stable_sort_task<_RandomAccessIterator1, _RandomAccessIterator2, _Compare, _Le
                                        _RandomAccessIterator2 __first2) {
                 return std::move(__first1, __last1, __first2);
             };
-            __m = new (allocate_continuation())
+            __m = new (tbb::task::allocate_continuation())
                 __merge_task<_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Compare,
-                             __binary_no_op, __serial_move_merge<decltype(__move_values), decltype(__move_sequences)>>(
-                    _M_xs, __xm, __xm, _M_xe, _M_zs, _M_comp, __binary_no_op(),
-                    __serial_move_merge<decltype(__move_values), decltype(__move_sequences)>(__nmerge, __move_values,
+                             __par_backend::__binary_no_op, __par_backend::__serial_move_merge<decltype(__move_values), decltype(__move_sequences)>>(
+                    _M_xs, __xm, __xm, _M_xe, _M_zs, _M_comp, __par_backend::__binary_no_op(),
+                    __par_backend::__serial_move_merge<decltype(__move_values), decltype(__move_sequences)>(__nmerge, __move_values,
                                                                                              __move_sequences));
         }
         __m->set_ref_count(2);
         task* __right = new (__m->allocate_child())
             __stable_sort_task(__xm, _M_xe, __zm, !_M_inplace, _M_comp, _M_leaf_sort, __nmerge);
-        spawn(*__right);
-        recycle_as_child_of(*__m);
+       tbb::task::spawn(*__right);
+       tbb::task::recycle_as_child_of(*__m);
         _M_xe = __xm;
         _M_inplace = !_M_inplace;
     }
@@ -628,10 +629,10 @@ __parallel_merge(_ExecutionPolicy&&, _RandomAccessIterator1 __xs, _RandomAccessI
     {
         tbb::this_task_arena::isolate([=]() {
             typedef __merge_task<_RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator3, _Compare,
-                                 __binary_no_op, _LeafMerge>
+                                 __par_backend::__binary_no_op, _LeafMerge>
                 _TaskType;
             tbb::task::spawn_root_and_wait(*new (tbb::task::allocate_root()) _TaskType(
-                __xs, __xe, __ys, __ye, __zs, __comp, __binary_no_op(), __leaf_merge));
+                __xs, __xe, __ys, __ye, __zs, __comp, __par_backend::__binary_no_op(), __leaf_merge));
         });
     }
 }
index 4fc63c0387327221088b9a873042f0088e472d8d..6313890144a8b620019032cfed53f7d8d2ef4c6d 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <iterator>
 #include <utility>
+#include <cassert>
 #include "utils.h"
 
 namespace __pstl
index b48b07b271c8c839df7ee1c19e06c739d38eeffb..da1f7495d2a64ba0dcfc244f9028b02cb126742d 100644 (file)
@@ -456,7 +456,7 @@ template <typename _Size, typename _Tp, typename _BinaryOperation, typename _Una
 typename std::enable_if<!is_arithmetic_plus<_Tp, _BinaryOperation>::value, _Tp>::type
 __simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _UnaryOperation __f) noexcept
 {
-    const std::size_t __block_size = __lane_size / sizeof(_Tp);
+    const _Size __block_size = __lane_size / sizeof(_Tp);
     if (__n > 2 * __block_size && __block_size > 1)
     {
         alignas(__lane_size) char __lane_[__lane_size];
@@ -796,7 +796,7 @@ __simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _Forwa
     {
         for (; __first != __last; ++__first)
         {
-            if (__simd_or(__s_first, __n2,
+           if (__unseq_backend::__simd_or(__s_first, __n2,
                           __internal::__equal_value_by_pred<decltype(*__first), _BinaryPredicate>(*__first, __pred)))
             {
                 return __first;
@@ -807,7 +807,7 @@ __simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _Forwa
     {
         for (; __s_first != __s_last; ++__s_first)
         {
-            const auto __result = __simd_first(__first, _DifferencType(0), __n1,
+           const auto __result = __unseq_backend::__simd_first(__first, _DifferencType(0), __n1,
                                                [__s_first, &__pred](_ForwardIterator1 __it, _DifferencType __i) {
                                                    return __pred(__it[__i], *__s_first);
                                                });
@@ -826,7 +826,7 @@ __simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredi
 {
     // find first element we need to remove
     auto __current =
-        __simd_first(__first, _DifferenceType(0), __n,
+        __unseq_backend::__simd_first(__first, _DifferenceType(0), __n,
                      [&__pred](_RandomAccessIterator __it, _DifferenceType __i) { return __pred(__it[__i]); });
     __n -= __current - __first;