40 #ifndef LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ARRAY_ATOMIC_HPP
41 #define LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ARRAY_ATOMIC_HPP
48 #include <libpmemobj/atomic_base.h>
73 typename detail::pp_if_array<T>::type &ptr,
76 typedef typename detail::pp_array_type<T>::type I;
78 auto ret = pmemobj_alloc(
pool.handle(), ptr.raw_ptr(),
sizeof(I) * N,
79 detail::type_num<I>(),
80 &detail::array_constructor<I>,
81 static_cast<void *
>(&N));
84 throw std::bad_alloc();
100 template <
typename T>
103 typename detail::pp_if_size_array<T>::type &ptr)
105 typedef typename detail::pp_array_type<T>::type I;
106 std::size_t N = detail::pp_array_elems<T>::elems;
108 auto ret = pmemobj_alloc(
pool.handle(), ptr.raw_ptr(),
sizeof(I) * N,
109 detail::type_num<I>(),
110 &detail::array_constructor<I>,
111 static_cast<void *
>(&N));
114 throw std::bad_alloc();
127 template <
typename T>
136 pmemobj_free(ptr.raw_ptr());
148 template <
typename T>
156 pmemobj_free(ptr.raw_ptr());