PMDK C++ bindings  1.13.0-git107.g7e59f08f
This is the C++ bindings documentation for PMDK's libpmemobj.
array_traits.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 /* Copyright 2016-2018, Intel Corporation */
3 
9 #ifndef LIBPMEMOBJ_CPP_ARRAY_TRAITS_HPP
10 #define LIBPMEMOBJ_CPP_ARRAY_TRAITS_HPP
11 
12 #include <cstddef>
13 
14 namespace pmem
15 {
16 
17 namespace detail
18 {
19 
20 /*
21  * Returns the number of array elements.
22  */
23 template <typename T>
24 struct pp_array_elems {
25  enum { elems = 1 };
26 };
27 
28 /*
29  * Returns the number of array elements.
30  */
31 template <typename T, size_t N>
32 struct pp_array_elems<T[N]> {
33  enum { elems = N };
34 };
35 
36 /*
37  * Returns the type of elements in an array.
38  */
39 template <typename T>
40 struct pp_array_type;
41 
42 /*
43  * Returns the type of elements in an array.
44  */
45 template <typename T>
46 struct pp_array_type<T[]> {
47  typedef T type;
48 };
49 
50 /*
51  * Returns the type of elements in an array.
52  */
53 template <typename T, size_t N>
54 struct pp_array_type<T[N]> {
55  typedef T type;
56 };
57 
58 } /* namespace detail */
59 
60 } /* namespace pmem */
61 
62 #endif /* LIBPMEMOBJ_CPP_ARRAY_TRAITS_HPP */
Persistent memory namespace.
Definition: allocation_flag.hpp:15