PMDK C++ bindings 1.13.0
This is the C++ bindings documentation for PMDK's libpmemobj.
Loading...
Searching...
No Matches
template_helpers.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2/* Copyright 2019-2020, Intel Corporation */
3
9#ifndef LIBPMEMOBJ_CPP_TEMPLATE_HELPERS_HPP
10#define LIBPMEMOBJ_CPP_TEMPLATE_HELPERS_HPP
11
12#include <type_traits>
13
14namespace pmem
15{
16
17namespace detail
18{
19
20template <typename... Ts>
21struct make_void {
22 typedef void type;
23};
24template <typename... Ts>
25using 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 */
29template <typename T, typename, template <typename> class... Checks>
30struct supports_impl {
31 using type = std::false_type;
32};
33template <typename T, template <typename> class... Checks>
34struct supports_impl<T, void_t<Checks<T>...>, Checks...> {
35 using type = std::true_type;
36};
37
38template <typename T, template <typename> class... Checks>
39using supports = typename supports_impl<T, void, Checks...>::type;
40
41template <typename Compare>
42using is_transparent = typename Compare::is_transparent;
43
44template <typename Compare>
45using has_is_transparent = detail::supports<Compare, is_transparent>;
46
47} /* namespace detail */
48
49} /* namespace pmem */
50
51#endif /* LIBPMEMOBJ_CPP_TEMPLATE_HELPERS_HPP */
Persistent memory namespace.
Definition: allocation_flag.hpp:15