forked from lewissbaker/cppcoro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathawaitable_traits.hpp
More file actions
27 lines (21 loc) · 795 Bytes
/
Copy pathawaitable_traits.hpp
File metadata and controls
27 lines (21 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCORO_AWAITABLE_TRAITS_HPP_INCLUDED
#define CPPCORO_AWAITABLE_TRAITS_HPP_INCLUDED
#include <cppcoro/detail/get_awaiter.hpp>
#include <type_traits>
namespace cppcoro
{
template<typename T, typename = void>
struct awaitable_traits
{};
template<typename T>
struct awaitable_traits<T, std::void_t<decltype(cppcoro::detail::get_awaiter(std::declval<T>()))>>
{
using awaiter_t = decltype(cppcoro::detail::get_awaiter(std::declval<T>()));
using await_result_t = decltype(std::declval<awaiter_t>().await_resume());
};
}
#endif