PMDK C++ bindings  1.10.1
This is the C++ bindings documentation for PMDK's libpmemobj.
template_helpers.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 /* Copyright 2019, Intel Corporation */
3 
9 #ifndef LIBPMEMOBJ_CPP_TEMPLATE_HELPERS_HPP
10 #define LIBPMEMOBJ_CPP_TEMPLATE_HELPERS_HPP
11 
12 #include <type_traits>
13 
14 namespace pmem
15 {
16 
17 namespace detail
18 {
19 
20 template <typename... Ts>
21 struct make_void {
22  typedef void type;
23 };
24 template <typename... Ts>
25 using void_t = typename make_void<Ts...>::type;
26 
27 /* Generic SFINAE helper for expression checks, based on the idea demonstrated
28  * in ISO C++ paper n4502 */
29 template <typename T, typename, template <typename> class... Checks>
30 struct supports_impl {
31  using type = std::false_type;
32 };
33 template <typename T, template <typename> class... Checks>
34 struct supports_impl<T, void_t<Checks<T>...>, Checks...> {
35  using type = std::true_type;
36 };
37 
38 template <typename T, template <typename> class... Checks>
39 using supports = typename supports_impl<T, void, Checks...>::type;
40 
41 } /* namespace detail */
42 
43 } /* namespace pmem */
44 
45 #endif /* LIBPMEMOBJ_CPP_TEMPLATE_HELPERS_HPP */
pmem
Persistent memory namespace.
Definition: allocation_flag.hpp:15