| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef _LIBCPP___COROUTINE_COROUTINE_TRAITS_H |
| 10 |
#define _LIBCPP___COROUTINE_COROUTINE_TRAITS_H |
| 11 |
|
| 12 |
#include <__config> |
| 13 |
#include <__type_traits/void_t.h> |
| 14 |
|
| 15 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 |
# pragma GCC system_header |
| 17 |
#endif |
| 18 |
|
| 19 |
#if _LIBCPP_STD_VER >= 20 |
| 20 |
|
| 21 |
_LIBCPP_BEGIN_NAMESPACE_STD |
| 22 |
|
| 23 |
// [coroutine.traits] |
| 24 |
// [coroutine.traits.primary] |
| 25 |
// The header <coroutine> defined the primary template coroutine_traits such that |
| 26 |
// if ArgTypes is a parameter pack of types and if the qualified-id R::promise_type |
| 27 |
// is valid and denotes a type ([temp.deduct]), then coroutine_traits<R, ArgTypes...> |
| 28 |
// has the following publicly accessible memebr: |
| 29 |
// |
| 30 |
// using promise_type = typename R::promise_type; |
| 31 |
// |
| 32 |
// Otherwise, coroutine_traits<R, ArgTypes...> has no members. |
| 33 |
template <class _Tp, class = void> |
| 34 |
struct __coroutine_traits_sfinae {}; |
| 35 |
|
| 36 |
template <class _Tp> |
| 37 |
struct __coroutine_traits_sfinae< _Tp, __void_t<typename _Tp::promise_type> > { |
| 38 |
using promise_type = typename _Tp::promise_type; |
| 39 |
}; |
| 40 |
|
| 41 |
template <class _Ret, class... _Args> |
| 42 |
struct coroutine_traits : public __coroutine_traits_sfinae<_Ret> {}; |
| 43 |
|
| 44 |
_LIBCPP_END_NAMESPACE_STD |
| 45 |
|
| 46 |
#endif // __LIBCPP_STD_VER >= 20 |
| 47 |
|
| 48 |
#endif // _LIBCPP___COROUTINE_COROUTINE_TRAITS_H |