]> git.proxmox.com Git - ceph.git/blob - ceph/src/spawn/include/spawn/detail/is_stack_allocator.hpp
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spawn / include / spawn / detail / is_stack_allocator.hpp
1 //
2 // detail/is_stack_allocator.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2019 Casey Bodley (cbodley at redhat dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10
11 #pragma once
12
13 #include <type_traits>
14
15 #include <boost/type_traits/make_void.hpp>
16
17 namespace spawn::detail {
18
19 template <typename T, typename = void>
20 struct is_stack_allocator : std::false_type {};
21
22 template <typename T>
23 struct is_stack_allocator<T, boost::void_t<decltype(
24 // boost::context::stack_context c = salloc.allocate();
25 std::declval<boost::context::stack_context>() = std::declval<T&>().allocate(),
26 // salloc.deallocate(c);
27 std::declval<T&>().deallocate(std::declval<boost::context::stack_context&>())
28 )>> : std::true_type {};
29
30 } // namespace spawn::detail