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
30 template <
int ControlSignatureIndex>
40 struct FunctionSigArity;
41 template <
typename R,
typename... ArgTypes>
42 struct FunctionSigArity<R(ArgTypes...)>
44 static constexpr std::size_t value =
sizeof...(ArgTypes);
48 template <
int... Args>
49 auto DefaultSigGenerator(vtkmstd::integer_sequence<int, 0, Args...>) -> void (*)(Arg<Args>...);
63 using seq = vtkmstd::make_integer_sequence<int, Length + 1>;
64 using type =
typename std::remove_pointer<decltype(DefaultSigGenerator(seq{}))>::type;
67 struct DefaultExecSig<1>
69 using type = void(Arg<1>);
72 struct DefaultExecSig<2>
74 using type = void(Arg<1>, Arg<2>);
77 struct DefaultExecSig<3>
79 using type = void(Arg<1>, Arg<2>, Arg<3>);
82 struct DefaultExecSig<4>
84 using type = void(Arg<1>, Arg<2>, Arg<3>, Arg<4>);
87 template <
bool HasExecSig_,
typename Sig_>
90 static constexpr
bool HasExecSig = HasExecSig_;
94 template <typename U, typename S = decltype(std::declval<typename U::ExecutionSignature>())>
95 static ExecSigQuery<true, typename U::ExecutionSignature> get_exec_sig(
int);
98 static ExecSigQuery<false, void> get_exec_sig(...);
115 template <
typename WorkletType>
118 using cont_sig =
typename WorkletType::ControlSignature;
119 using cont_sig_info = vtkm::placeholders::FunctionSigArity<cont_sig>;
121 using result = decltype(get_exec_sig<WorkletType>(0));
122 static constexpr
bool has_explicit_exec_sig = result::HasExecSig;
124 using ExecutionSignature =
typename std::conditional<
125 has_explicit_exec_sig,
126 typename result::Sig,
127 typename vtkm::placeholders::DefaultExecSig<cont_sig_info::value>::type>::type;