PMDK C++ bindings
1.5.2
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Go to the documentation of this file.
40 #ifndef LIBPMEMOBJ_CPP_MAKE_PERSISTENT_HPP
41 #define LIBPMEMOBJ_CPP_MAKE_PERSISTENT_HPP
47 #include <libpmemobj/tx_base.h>
73 template <
typename T,
typename... Args>
74 typename detail::pp_if_not_array<T>::type
77 if (pmemobj_tx_stage() != TX_STAGE_WORK)
79 "refusing to allocate "
80 "memory outside of transaction scope");
83 pmemobj_tx_alloc(
sizeof(T), detail::type_num<T>());
87 "persistent memory object");
89 detail::create<T, Args...>(ptr.get(), std::forward<Args>(args)...);
108 template <
typename T>
112 if (pmemobj_tx_stage() != TX_STAGE_WORK)
115 "memory outside of transaction scope");
124 detail::destroy<T>(*ptr);
126 if (pmemobj_tx_free(*ptr.raw_ptr()) != 0)
128 "persistent memory object");
void delete_persistent(typename detail::pp_if_not_array< T >::type ptr)
Transactionally free an object of type T held in a persistent_ptr.
Definition: make_persistent.hpp:110
Custom transaction error class.
Definition: pexceptions.hpp:94
detail::pp_if_not_array< T >::type make_persistent(Args &&... args)
Transactionally allocate and construct an object of type T.
Definition: make_persistent.hpp:75
Commonly used functionality.
Compile time type check for make_persistent.
Persistent pointer class.
Definition: persistent_ptr.hpp:132
Functions for destroying arrays.
Custom transaction error class.
Definition: pexceptions.hpp:104
Custom transaction error class.
Definition: pexceptions.hpp:84