#ifndef _PSTL_ALGORITHM_IMPL_H
#define _PSTL_ALGORITHM_IMPL_H
+#include <__assert>
#include <algorithm>
#include <functional>
#include <iterator>
__first2,
__last2,
[__first1, __last1, __first2, __last2, &__comp](_RandomAccessIterator2 __i, _RandomAccessIterator2 __j) {
- _PSTL_ASSERT(__j > __i);
- //_PSTL_ASSERT(__j - __i > 1);
+ _LIBCPP_ASSERT(__j > __i, "");
+ //_LIBCPP_ASSERT(__j - __i > 1, "");
// 1. moving boundaries to "consume" subsequence of equal elements
auto __is_equal = [&__comp](_RandomAccessIterator2 __a, _RandomAccessIterator2 __b) -> bool {
// 2. testing is __a subsequence of the second range included into the first range
auto __b = std::lower_bound(__first1, __last1, *__i, __comp);
- _PSTL_ASSERT(!__comp(*(__last1 - 1), *__b));
- _PSTL_ASSERT(!__comp(*(__j - 1), *__i));
+ _LIBCPP_ASSERT(!__comp(*(__last1 - 1), *__b), "");
+ _LIBCPP_ASSERT(!__comp(*(__j - 1), *__i), "");
return !std::includes(__b, __last1, __i, __j, __comp);
});
});
}
const auto __m2 = __left_bound_seq_2 - __first2;
- _PSTL_ASSERT(__m1 == 0 || __m2 == 0);
+ _LIBCPP_ASSERT(__m1 == 0 || __m2 == 0, "");
if (__m2 > __set_algo_cut_off) {
auto __res_or = __result;
__result += __m2; // we know proper offset due to [first2; left_bound_seq_2) < [first1; last1)
#ifndef _PSTL_PARALLEL_BACKEND_TBB_H
#define _PSTL_PARALLEL_BACKEND_TBB_H
+#include <__assert>
#include <algorithm>
#include <type_traits>
__task*
allocate_func_task(_Fn&& __f)
{
- _PSTL_ASSERT(_M_execute_data != nullptr);
+ _LIBCPP_ASSERT(_M_execute_data != nullptr, "");
tbb::detail::d1::small_object_allocator __alloc{};
auto __t =
__alloc.new_object<__func_task<typename std::decay<_Fn>::type>>(*_M_execute_data, std::forward<_Fn>(__f));
make_additional_child_of(__task* __parent, _Fn&& __f)
{
auto __t = make_child_of(__parent, std::forward<_Fn>(__f));
- _PSTL_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0);
+ _LIBCPP_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, "");
++__parent->_M_refcount;
return __t;
}
inline void
spawn(__task* __t)
{
- _PSTL_ASSERT(_M_execute_data != nullptr);
+ _LIBCPP_ASSERT(_M_execute_data != nullptr, "");
tbb::detail::d1::spawn(*__t, *_M_execute_data->context);
}
this->~__func_task();
- _PSTL_ASSERT(__parent != nullptr);
- _PSTL_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0);
+ _LIBCPP_ASSERT(__parent != nullptr, "");
+ _LIBCPP_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, "");
if (--__parent->_M_refcount == 0)
{
- _PSTL_ASSERT(__next == nullptr);
+ _LIBCPP_ASSERT(__next == nullptr, "");
__alloc.deallocate(this, *__ed);
return __parent;
}
{
const auto __nx = (_M_xe - _M_xs);
const auto __ny = (_M_ye - _M_ys);
- _PSTL_ASSERT(__nx > 0 && __ny > 0);
+ _LIBCPP_ASSERT(__nx > 0 && __ny > 0, "");
- _PSTL_ASSERT(_x_orig == _y_orig);
- _PSTL_ASSERT(!is_partial());
+ _LIBCPP_ASSERT(_x_orig == _y_orig, "");
+ _LIBCPP_ASSERT(!is_partial(), "");
if (_x_orig)
{
- _PSTL_ASSERT(std::is_sorted(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_comp));
- _PSTL_ASSERT(std::is_sorted(_M_x_beg + _M_ys, _M_x_beg + _M_ye, _M_comp));
+ _LIBCPP_ASSERT(std::is_sorted(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_comp), "");
+ _LIBCPP_ASSERT(std::is_sorted(_M_x_beg + _M_ys, _M_x_beg + _M_ye, _M_comp), "");
return !_M_comp(*(_M_x_beg + _M_ys), *(_M_x_beg + _M_xe - 1));
}
- _PSTL_ASSERT(std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp));
- _PSTL_ASSERT(std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp));
+ _LIBCPP_ASSERT(std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp), "");
+ _LIBCPP_ASSERT(std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp), "");
return !_M_comp(*(_M_z_beg + _M_zs + __nx), *(_M_z_beg + _M_zs + __nx - 1));
}
void
{
const auto __nx = (_M_xe - _M_xs);
const auto __ny = (_M_ye - _M_ys);
- _PSTL_ASSERT(__nx > 0 && __ny > 0);
+ _LIBCPP_ASSERT(__nx > 0 && __ny > 0, "");
if (_x_orig)
__move_range_construct()(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_z_beg + _M_zs);
__task*
merge_ranges(__task* __self)
{
- _PSTL_ASSERT(_x_orig == _y_orig); //two merged subrange must be lie into the same buffer
+ _LIBCPP_ASSERT(_x_orig == _y_orig, ""); //two merged subrange must be lie into the same buffer
const auto __nx = (_M_xe - _M_xs);
const auto __ny = (_M_ye - _M_ys);
_M_leaf_merge(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_x_beg + _M_ys, _M_x_beg + _M_ye, _M_z_beg + _M_zs,
_M_comp, __move_value_construct(), __move_value_construct(), __move_range_construct(),
__move_range_construct());
- _PSTL_ASSERT(parent_merge(__self)); //not root merging task
+ _LIBCPP_ASSERT(parent_merge(__self), ""); //not root merging task
}
//merge to "origin"
else
{
- _PSTL_ASSERT(_x_orig == _y_orig);
+ _LIBCPP_ASSERT(_x_orig == _y_orig, "");
- _PSTL_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp));
- _PSTL_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp));
+ _LIBCPP_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp), "");
+ _LIBCPP_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp), "");
const auto __nx = (_M_xe - _M_xs);
const auto __ny = (_M_ye - _M_ys);
__task*
process_ranges(__task* __self)
{
- _PSTL_ASSERT(_x_orig == _y_orig);
- _PSTL_ASSERT(!_split);
+ _LIBCPP_ASSERT(_x_orig == _y_orig, "");
+ _LIBCPP_ASSERT(!_split, "");
auto p = parent_merge(__self);
__task*
split_merging(__task* __self)
{
- _PSTL_ASSERT(_x_orig == _y_orig);
+ _LIBCPP_ASSERT(_x_orig == _y_orig, "");
const auto __nx = (_M_xe - _M_xs);
const auto __ny = (_M_ye - _M_ys);
{
const _SizeType __nx = (_M_xe - _M_xs);
const _SizeType __ny = (_M_ye - _M_ys);
- _PSTL_ASSERT(__nx > 0);
- _PSTL_ASSERT(__nx > 0);
+ _LIBCPP_ASSERT(__nx > 0, "");
+ _LIBCPP_ASSERT(__nx > 0, "");
if (__nx < __ny)
move_x_range();
if (__n <= __sort_cut_off)
{
_M_leaf_sort(_M_xs, _M_xe, _M_comp);
- _PSTL_ASSERT(!_M_root);
+ _LIBCPP_ASSERT(!_M_root, "");
return nullptr;
}