38 #ifndef LIBPMEMOBJ_CPP_MAKE_ATOMIC_IMPL_HPP
39 #define LIBPMEMOBJ_CPP_MAKE_ATOMIC_IMPL_HPP
59 template <
typename T,
size_t... Indices,
typename... Args>
61 create_object(
void *ptr, index_sequence<Indices...>, std::tuple<Args...> &tuple)
63 new (ptr) T(std::get<Indices>(tuple)...);
71 template <
typename T,
typename... Args>
73 obj_constructor(PMEMobjpool *pop,
void *ptr,
void *arg)
75 auto *arg_pack =
static_cast<std::tuple<Args &...
> *>(arg);
77 typedef typename make_index_sequence<Args...>::type index;
79 create_object<T>(ptr, index(), *arg_pack);
84 pmemobj_persist(pop, ptr,
sizeof(T));
97 array_constructor(PMEMobjpool *pop,
void *ptr,
void *arg)
99 std::size_t N = *
static_cast<std::size_t *
>(arg);
101 T *tptr =
static_cast<T *
>(ptr);
103 for (std::size_t i = 0; i < N; ++i)
104 detail::create<T>(tptr + i);
109 pmemobj_persist(pop, ptr,
sizeof(T) * N);