forked from lewissbaker/cppcoro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathis_awaitable.hpp
More file actions
26 lines (20 loc) · 745 Bytes
/
is_awaitable.hpp
File metadata and controls
26 lines (20 loc) · 745 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
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCORO_IS_AWAITABLE_HPP_INCLUDED
#define CPPCORO_IS_AWAITABLE_HPP_INCLUDED
#include <cppcoro/detail/get_awaiter.hpp>
#include <type_traits>
namespace cppcoro
{
template<typename T, typename = std::void_t<>>
struct is_awaitable : std::false_type {};
template<typename T>
struct is_awaitable<T, std::void_t<decltype(cppcoro::detail::get_awaiter(std::declval<T>()))>>
: std::true_type
{};
template<typename T>
constexpr bool is_awaitable_v = is_awaitable<T>::value;
}
#endif