28 #ifndef VC_TRAITS_IS_FUNCTOR_ARGUMENT_IMMUTABLE_H_
29 #define VC_TRAITS_IS_FUNCTOR_ARGUMENT_IMMUTABLE_H_
31 namespace Vc_VERSIONED_NAMESPACE
35 namespace is_functor_argument_immutable_impl
37 template <
typename F,
typename A> std::true_type test(
void (F::*)(A));
38 template <
typename F,
typename A> std::true_type test(
void (F::*)(A)
const);
39 template <
typename F,
typename A> std::is_const<A> test(
void (F::*)(A &));
40 template <
typename F,
typename A> std::is_const<A> test(
void (F::*)(A &)
const);
41 template <
typename F,
typename A> std::is_const<A> test(
void (F::*)(A &&));
42 template <
typename F,
typename A> std::is_const<A> test(
void (F::*)(A &&)
const);
49 typename F,
typename A
57 typename = decltype(std::declval<F &>()(std::declval<dummy &>()))
65 #define Vc_TEMPLATE_ template
67 typename MemberPtr = decltype(&F::Vc_TEMPLATE_
operator()<A>)>
68 decltype(is_functor_argument_immutable_impl::test(std::declval<MemberPtr>())) test2(
int);
73 template <
typename F,
typename A>
75 is_functor_argument_immutable_impl::test(std::declval<decltype(&F::operator())>()))
78 template <typename A>
std::true_type test3(
void(*)(A));
79 template <typename A>
std::is_const<A> test3(
void(*)(A &));
80 template <typename A>
std::is_const<A> test3(
void(*)(A &&));
84 template <typename F, typename A,
bool =
std::is_function<F>::value>
85 struct is_functor_argument_immutable;
86 template <typename F, typename A>
87 struct is_functor_argument_immutable<F, A, false>
88 : public decltype(is_functor_argument_immutable_impl::test2<
89 typename
std::remove_reference<F>::type, A>(
int())) {
91 template <
typename F,
typename A>
92 struct is_functor_argument_immutable<F, A, true>
93 :
public decltype(is_functor_argument_immutable_impl::test3(std::declval<F>())) {
99 #endif // VC_TRAITS_IS_FUNCTOR_ARGUMENT_IMMUTABLE_H_