11 #ifndef LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ARRAY_ATOMIC_HPP
12 #define LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ARRAY_ATOMIC_HPP
21 #include <libpmemobj/atomic_base.h>
51 typedef typename detail::pp_array_type<T>::type I;
53 auto ret = pmemobj_xalloc(
pool.handle(), ptr.raw_ptr(),
sizeof(I) * N,
54 detail::type_num<I>(), flag.value,
55 &detail::array_constructor<I>,
56 static_cast<void *
>(&N));
59 throw std::bad_alloc();
79 pool_base &
pool,
typename detail::pp_if_size_array<T>::type &ptr,
82 typedef typename detail::pp_array_type<T>::type I;
83 std::size_t N = detail::pp_array_elems<T>::elems;
85 auto ret = pmemobj_xalloc(
pool.handle(), ptr.raw_ptr(),
sizeof(I) * N,
86 detail::type_num<I>(), flag.value,
87 &detail::array_constructor<I>,
88 static_cast<void *
>(&N));
91 throw std::bad_alloc();
104 template <
typename T>
113 pmemobj_free(ptr.raw_ptr());
125 template <
typename T>
133 pmemobj_free(ptr.raw_ptr());