PMDK C++ bindings  1.12.1-rc1
This is the C++ bindings documentation for PMDK's libpmemobj.
Classes | Public Member Functions | List of all members
pmem::obj::object_traits< T > Class Template Reference

Encapsulates object specific allocator functionality. More...

#include <libpmemobj++/allocator.hpp>

Inheritance diagram for pmem::obj::object_traits< T >:
pmem::obj::allocator< T, Policy, Traits >

Classes

struct  rebind
 Rebind to a different type. More...
 

Public Member Functions

 object_traits ()=default
 Defaulted constructor.
 
 ~object_traits ()=default
 Defaulted destructor.
 
template<typename U , typename = typename std::enable_if< std::is_convertible<U *, T *>::value>::type>
 object_traits (object_traits< U > const &)
 Type converting constructor.
 
void construct (pointer p, const_reference t)
 Create an object at a specific address. More...
 
template<typename... Args>
void construct (pointer p, Args &&... args)
 Create an object at a specific address. More...
 
void destroy (pointer p)
 Destroy an object based on a pointer. More...
 

Detailed Description

template<typename T>
class pmem::obj::object_traits< T >

Encapsulates object specific allocator functionality.

Designed to be used with C++ allocators. Can be specialized if necessary.

Member Function Documentation

◆ construct() [1/2]

template<typename T >
template<typename... Args>
void pmem::obj::object_traits< T >::construct ( pointer  p,
Args &&...  args 
)
inline

Create an object at a specific address.

This should be called only within a transaction.

Parameters
[in]pthe pointer to where the object will be constructed.
[in]argsparameters passed to the object's constructor.
Exceptions
transaction_scope_errorif called outside of an active transaction.
rethrowsexception from T constructor.

◆ construct() [2/2]

template<typename T >
void pmem::obj::object_traits< T >::construct ( pointer  p,
const_reference  t 
)
inline

Create an object at a specific address.

This should be called only within a transaction.

Parameters
[in]pthe pointer to where the object will be constructed.
[in]tthe object reference for copy construction.
Exceptions
transaction_scope_errorif called outside of an active transaction.
rethrowsexception from T constructor.

◆ destroy()

template<typename T >
void pmem::obj::object_traits< T >::destroy ( pointer  p)
inline

Destroy an object based on a pointer.

This should be called only within a transaction.

Parameters
[in]pthe pointer to the object to be destroyed.

The documentation for this class was generated from the following file: