chromium/third_party/libc++/src/include/__functional/weak_result_type.h

// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___FUNCTIONAL_WEAK_RESULT_TYPE_H
#define _LIBCPP___FUNCTIONAL_WEAK_RESULT_TYPE_H

#include <__config>
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
#include <__functional/unary_function.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_same.h>
#include <__utility/declval.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Tp>
struct __has_result_type {};

// __weak_result_type

template <class _Tp>
struct __derives_from_unary_function {};

template <class _Tp>
struct __derives_from_binary_function {};

template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
struct __maybe_derive_from_unary_function // bool is true
    : public __derives_from_unary_function<_Tp>::type {};

__maybe_derive_from_unary_function<_Tp, false>;

template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
struct __maybe_derive_from_binary_function // bool is true
    : public __derives_from_binary_function<_Tp>::type {};

__maybe_derive_from_binary_function<_Tp, false>;

template <class _Tp, bool = __has_result_type<_Tp>::value>
struct __weak_result_type_imp // bool is true
    : public __maybe_derive_from_unary_function<_Tp>,
      public __maybe_derive_from_binary_function<_Tp> {};

__weak_result_type_imp<_Tp, false>;

template <class _Tp>
struct __weak_result_type : public __weak_result_type_imp<_Tp> {};

// 0 argument case

__weak_result_type<_Rp ()>;

__weak_result_type<_Rp (&)()>;

__weak_result_type<_Rp (*)()>;

// 1 argument case

__weak_result_type<_Rp (_A1)>;

__weak_result_type<_Rp (&)(_A1)>;

__weak_result_type<_Rp (*)(_A1)>;

__weak_result_type<_Rp (_Cp::*)()>;

__weak_result_type<_Rp (_Cp::*)() const>;

__weak_result_type<_Rp (_Cp::*)() volatile>;

__weak_result_type<_Rp (_Cp::*)() const volatile>;

// 2 argument case

__weak_result_type<_Rp (_A1, _A2)>;

__weak_result_type<_Rp (*)(_A1, _A2)>;

__weak_result_type<_Rp (&)(_A1, _A2)>;

__weak_result_type<_Rp (_Cp::*)(_A1)>;

__weak_result_type<_Rp (_Cp::*)(_A1) const>;

__weak_result_type<_Rp (_Cp::*)(_A1) volatile>;

__weak_result_type<_Rp (_Cp::*)(_A1) const volatile>;

// 3 or more arguments

__weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>;

__weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>;

__weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>;

__weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>;

__weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>;

__weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>;

__weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>;

template <class _Tp, class... _Args>
struct __invoke_return {};

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___FUNCTIONAL_WEAK_RESULT_TYPE_H