9 #ifndef LIBPMEMOBJ_CPP_V_HPP
10 #define LIBPMEMOBJ_CPP_V_HPP
24 namespace experimental
45 static_assert(std::is_default_constructible<T>::value,
46 "Type T must be default constructible");
83 return *
this = rhs.
get();
92 typename =
typename std::enable_if<
93 std::is_convertible<Y, T>::value>::type>
97 return *
this = rhs.
get();
109 template <
typename... Args>
111 get(Args &&... args) noexcept
114 std::forward_as_tuple(std::forward<Args>(args)...);
116 PMEMobjpool *pop = pmemobj_pool_by_ptr(
this);
120 T *value =
static_cast<T *
>(pmemobj_volatile(
121 pop, &this->vlt, &this->val,
sizeof(T),
122 pmem::detail::c_style_construct<T, decltype(arg_pack),
124 static_cast<void *
>(&arg_pack)));
146 operator T &() noexcept
157 std::swap(
get(), other.
get());
Volatile residing on pmem class.
Definition: v.hpp:43
v & operator=(const T &rhs)
Assignment operator.
Definition: v.hpp:67
T & unsafe_get()
Retrieves reference to the object.
Definition: v.hpp:138
v & operator=(v &rhs)
Assignment operator.
Definition: v.hpp:81
void swap(v &other)
Swaps two v objects of the same type.
Definition: v.hpp:155
v() noexcept
Defaulted constructor.
Definition: v.hpp:51
void swap(v< T > &a, v< T > &b)
Swaps two v objects of the same type.
Definition: v.hpp:183
T & get(Args &&... args) noexcept
Retrieves reference to the object.
Definition: v.hpp:111
v & operator=(v< Y > &rhs)
Converting assignment operator from a different v<>.
Definition: v.hpp:95
~v()
Destructor.
Definition: v.hpp:58
Commonly used functionality.
Functions for lifetime management.
Persistent memory namespace.
Definition: allocation_flag.hpp:15