chromium/third_party/skia/src/utils/SkCallableTraits.h

/*
 * Copyright 2018 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkCallableTraits_DEFINED
#define SkCallableTraits_DEFINED

#include <type_traits>
#include <tuple>

template <typename R, typename... Args> struct sk_base_callable_traits {};

#define SK_CALLABLE_TRAITS__COMMA

#define SK_CALLABLE_TRAITS__VARARGS

#ifdef __cpp_noexcept_function_type
#define SK_CALLABLE_TRAITS__NE_VARARGS
#else
#define SK_CALLABLE_TRAITS__NE_VARARGS
#endif

#define SK_CALLABLE_TRAITS__REF_NE_VARARGS

#define SK_CALLABLE_TRAITS__CV_REF_NE_VARARGS

/** Infer the return_type and argument<N> of a callable type T. */
template <typename T> struct SkCallableTraits : SkCallableTraits<decltype(&T::operator())> {};

// function (..., (const, volatile), (&, &&), noexcept)
#define SK_CALLABLE_TRAITS__INSTANCE

SK_CALLABLE_TRAITS__CV_REF_NE_VARARGS
#undef SK_CALLABLE_TRAITS__INSTANCE

// pointer to function (..., noexcept)
#define SK_CALLABLE_TRAITS__INSTANCE

SK_CALLABLE_TRAITS__NE_VARARGS
#undef SK_CALLABLE_TRAITS__INSTANCE

// pointer to method (..., (const, volatile), (&, &&), noexcept)
#define SK_CALLABLE_TRAITS__INSTANCE

SK_CALLABLE_TRAITS__CV_REF_NE_VARARGS
#undef SK_CALLABLE_TRAITS__INSTANCE

// pointer to field
SkCallableTraits<R T::*>;

#undef SK_CALLABLE_TRAITS__CV_REF_NE_VARARGS
#undef SK_CALLABLE_TRAITS__REF_NE_VARARGS
#undef SK_CALLABLE_TRAITS__NE_VARARGS
#undef SK_CALLABLE_TRAITS__VARARGS
#undef SK_CALLABLE_TRAITS__COMMA

#endif