Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Hoeflinger <[email protected]>
  • Loading branch information
danhoeflinger committed Dec 30, 2024
1 parent 95d483f commit 0942617
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions include/oneapi/dpl/pstl/omp/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,29 @@ __process_chunk(const __chunk_metrics& __metrics, _Iterator __base, _Index __chu
__f(__first, __last);
}

template<typename _StorageType>
class __construct_by_args_base {
public:
virtual ~__construct_by_args_base() { }
virtual std::unique_ptr<_StorageType> construct() = 0;
template <typename _StorageType>
class __construct_by_args_base
{
public:
virtual ~__construct_by_args_base() {}
virtual std::unique_ptr<_StorageType>
construct() = 0;
};

template<typename _StorageType, typename... _P>
class __construct_by_args: public __construct_by_args_base<_StorageType>{
public:
std::unique_ptr<_StorageType> construct() {
return std::move(std::apply([](auto... __arg_pack) { return std::make_unique<_StorageType>(__arg_pack...);}, pack));
template <typename _StorageType, typename... _P>
class __construct_by_args : public __construct_by_args_base<_StorageType>
{
public:
std::unique_ptr<_StorageType>
construct()
{
return std::move(
std::apply([](auto... __arg_pack) { return std::make_unique<_StorageType>(__arg_pack...); }, pack));
}
__construct_by_args( _P&& ... args ) : pack(std::forward<_P>(args)...) {}
private:
std::tuple<_P...> pack;
__construct_by_args(_P&&... args) : pack(std::forward<_P>(args)...) {}

private:
std::tuple<_P...> pack;
};

template <typename _StorageType>
Expand All @@ -180,10 +187,7 @@ struct __thread_enumerable_storage
{
__construct_helper = std::make_unique<__construct_by_args<_StorageType, Args...>>(std::forward<Args>(args)...);
_PSTL_PRAGMA(omp parallel)
_PSTL_PRAGMA(omp single)
{
__thread_specific_storage.resize(omp_get_num_threads());
}
_PSTL_PRAGMA(omp single) { __thread_specific_storage.resize(omp_get_num_threads()); }
}

std::uint32_t
Expand All @@ -207,7 +211,7 @@ struct __thread_enumerable_storage
}
}
// Need to back up one once we have found a valid element
return *__thread_specific_storage[__j-1];
return *__thread_specific_storage[__j - 1];
}
}

Expand Down

0 comments on commit 0942617

Please sign in to comment.