10 #ifndef vtk_m_worklet_internal_Placeholders_h
11 #define vtk_m_worklet_internal_Placeholders_h
13 #include <vtkmstd/integer_sequence.h>
15 #include <type_traits>
21 namespace placeholders
25 template <
int ControlSignatureIndex>
35 struct FunctionSigArity;
36 template <
typename R,
typename... ArgTypes>
37 struct FunctionSigArity<R(ArgTypes...)>
39 static constexpr std::size_t value =
sizeof...(ArgTypes);
43 template <
int... Args>
44 auto DefaultSigGenerator(vtkmstd::integer_sequence<int, 0, Args...>) -> void (*)(Arg<Args>...);
58 using seq = vtkmstd::make_integer_sequence<int, Length + 1>;
59 using type =
typename std::remove_pointer<decltype(DefaultSigGenerator(seq{}))>::type;
62 struct DefaultExecSig<1>
64 using type = void(Arg<1>);
67 struct DefaultExecSig<2>
69 using type = void(Arg<1>, Arg<2>);
72 struct DefaultExecSig<3>
74 using type = void(Arg<1>, Arg<2>, Arg<3>);
77 struct DefaultExecSig<4>
79 using type = void(Arg<1>, Arg<2>, Arg<3>, Arg<4>);
82 template <
bool HasExecSig_,
typename Sig_>
85 static constexpr
bool HasExecSig = HasExecSig_;
89 template <typename U, typename S = decltype(std::declval<typename U::ExecutionSignature>())>
90 static ExecSigQuery<true, typename U::ExecutionSignature> get_exec_sig(
int);
93 static ExecSigQuery<false, void> get_exec_sig(...);
110 template <
typename WorkletType>
113 using cont_sig =
typename WorkletType::ControlSignature;
114 using cont_sig_info = vtkm::placeholders::FunctionSigArity<cont_sig>;
116 using result = decltype(get_exec_sig<WorkletType>(0));
117 static constexpr
bool has_explicit_exec_sig = result::HasExecSig;
119 using ExecutionSignature =
typename std::conditional<
120 has_explicit_exec_sig,
121 typename result::Sig,
122 typename vtkm::placeholders::DefaultExecSig<cont_sig_info::value>::type>::type;