From 379833c1b3dccb4e0a17ccb5c26ed23ace9be91b Mon Sep 17 00:00:00 2001 From: Adam Lugowski Date: Wed, 6 Dec 2023 18:47:38 -0800 Subject: [PATCH] Enable forwards of non-std functions --- include/poolstl/seq_fwd.hpp | 72 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/include/poolstl/seq_fwd.hpp b/include/poolstl/seq_fwd.hpp index 1cba06c..58e9053 100644 --- a/include/poolstl/seq_fwd.hpp +++ b/include/poolstl/seq_fwd.hpp @@ -12,17 +12,17 @@ * Forward poolstl::seq to the native sequential (no policy) method. */ -#define POOLSTL_DEFINE_SEQ_FWD(FNAME) \ +#define POOLSTL_DEFINE_SEQ_FWD(NS, FNAME) \ template \ auto FNAME(EP&&, ARGS&&...args) -> \ - poolstl::internal::enable_if_seq(args)...))> { \ - return std::FNAME(std::forward(args)...); \ + poolstl::internal::enable_if_seq(args)...))> { \ + return NS::FNAME(std::forward(args)...); \ } -#define POOLSTL_DEFINE_SEQ_FWD_VOID(FNAME) \ +#define POOLSTL_DEFINE_SEQ_FWD_VOID(NS, FNAME) \ template \ poolstl::internal::enable_if_seq FNAME(EP&&, ARGS&&... args) { \ - std::FNAME(std::forward(args)...); \ + NS::FNAME(std::forward(args)...); \ } #if POOLSTL_HAVE_CXX17 @@ -32,63 +32,63 @@ * Useful to choose between parallel and sequential policies at runtime via par_if. */ -#define POOLSTL_DEFINE_PAR_IF_FWD_VOID(FNAME) \ +#define POOLSTL_DEFINE_PAR_IF_FWD_VOID(NS, FNAME) \ template \ poolstl::internal::enable_if_poolstl_variant FNAME(EP&& policy, ARGS&&...args) { \ - std::visit([&](auto&& pol) { std::FNAME(pol, std::forward(args)...); }, policy.var); \ + std::visit([&](auto&& pol) { NS::FNAME(pol, std::forward(args)...); }, policy.var); \ } -#define POOLSTL_DEFINE_PAR_IF_FWD(FNAME) \ +#define POOLSTL_DEFINE_PAR_IF_FWD(NS, FNAME) \ template \ auto FNAME(EP&& policy, ARGS&&...args) -> \ - poolstl::internal::enable_if_poolstl_variant(args)...))> { \ - return std::visit([&](auto&& pol) { return std::FNAME(pol, std::forward(args)...); }, policy.var); \ + poolstl::internal::enable_if_poolstl_variant(args)...))> { \ + return std::visit([&](auto&& pol) { return NS::FNAME(pol, std::forward(args)...); }, policy.var); \ } #else -#define POOLSTL_DEFINE_PAR_IF_FWD_VOID(FNAME) -#define POOLSTL_DEFINE_PAR_IF_FWD(FNAME) +#define POOLSTL_DEFINE_PAR_IF_FWD_VOID(NS, FNAME) +#define POOLSTL_DEFINE_PAR_IF_FWD(NS, FNAME) #endif /* * Define both the sequential forward and dynamic chooser. */ -#define POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(FNAME) \ - POOLSTL_DEFINE_SEQ_FWD(FNAME) \ - POOLSTL_DEFINE_PAR_IF_FWD(FNAME) +#define POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(NS, FNAME) \ + POOLSTL_DEFINE_SEQ_FWD(NS, FNAME) \ + POOLSTL_DEFINE_PAR_IF_FWD(NS, FNAME) -#define POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF_VOID(FNAME) \ - POOLSTL_DEFINE_SEQ_FWD_VOID(FNAME) \ - POOLSTL_DEFINE_PAR_IF_FWD_VOID(FNAME) +#define POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF_VOID(NS, FNAME) \ + POOLSTL_DEFINE_SEQ_FWD_VOID(NS, FNAME) \ + POOLSTL_DEFINE_PAR_IF_FWD_VOID(NS, FNAME) namespace std { - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(all_of) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(any_of) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(none_of) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, all_of) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, any_of) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, none_of) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(count) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(count_if) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, count) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, count_if) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(copy) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(copy_n) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, copy) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, copy_n) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF_VOID(fill) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(fill_n) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF_VOID(std, fill) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, fill_n) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(find) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(find_if) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(find_if_not) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, find) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, find_if) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, find_if_not) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF_VOID(for_each) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF_VOID(std, for_each) #if POOLSTL_HAVE_CXX17_LIB - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(for_each_n) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, for_each_n) #endif - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(transform) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, transform) #if POOLSTL_HAVE_CXX17_LIB - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(exclusive_scan) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(reduce) - POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(transform_reduce) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, exclusive_scan) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, reduce) + POOLSTL_DEFINE_BOTH_SEQ_FWD_AND_PAR_IF(std, transform_reduce) #endif }