PMDK C++ bindings  1.5.2
This is the C++ bindings documentation for PMDK's libpmemobj.
Classes | Functions
persistent_ptr.hpp File Reference

Persistent smart pointer. More...

#include <cassert>
#include <limits>
#include <memory>
#include <ostream>
#include <libpmemobj++/detail/common.hpp>
#include <libpmemobj++/detail/persistent_ptr_base.hpp>
#include <libpmemobj++/detail/specialization.hpp>
#include <libpmemobj++/pool.hpp>
#include <libpmemobj.h>

Go to the source code of this file.

Classes

class  pmem::obj::persistent_ptr< T >
 Persistent pointer class. More...
 

Functions

template<class T >
void pmem::obj::swap (persistent_ptr< T > &a, persistent_ptr< T > &b)
 Swaps two persistent_ptr objects of the same type. More...
 
template<typename T , typename Y >
bool pmem::obj::operator== (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs) noexcept
 Equality operator. More...
 
template<typename T , typename Y >
bool pmem::obj::operator!= (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs) noexcept
 Inequality operator.
 
template<typename T >
bool pmem::obj::operator== (persistent_ptr< T > const &lhs, std::nullptr_t) noexcept
 Equality operator with nullptr.
 
template<typename T >
bool pmem::obj::operator== (std::nullptr_t, persistent_ptr< T > const &lhs) noexcept
 Equality operator with nullptr.
 
template<typename T >
bool pmem::obj::operator!= (persistent_ptr< T > const &lhs, std::nullptr_t) noexcept
 Inequality operator with nullptr.
 
template<typename T >
bool pmem::obj::operator!= (std::nullptr_t, persistent_ptr< T > const &lhs) noexcept
 Inequality operator with nullptr.
 
template<typename T , typename Y >
bool pmem::obj::operator< (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs) noexcept
 Less than operator. More...
 
template<typename T , typename Y >
bool pmem::obj::operator<= (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs) noexcept
 Less or equal than operator. More...
 
template<typename T , typename Y >
bool pmem::obj::operator> (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs) noexcept
 Greater than operator. More...
 
template<typename T , typename Y >
bool pmem::obj::operator>= (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs) noexcept
 Greater or equal than operator. More...
 
template<typename T >
bool pmem::obj::operator< (persistent_ptr< T > const &lhs, std::nullptr_t) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator< (std::nullptr_t, persistent_ptr< T > const &rhs) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator<= (persistent_ptr< T > const &lhs, std::nullptr_t) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator<= (std::nullptr_t, persistent_ptr< T > const &rhs) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator> (persistent_ptr< T > const &lhs, std::nullptr_t) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator> (std::nullptr_t, persistent_ptr< T > const &rhs) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator>= (persistent_ptr< T > const &lhs, std::nullptr_t) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
bool pmem::obj::operator>= (std::nullptr_t, persistent_ptr< T > const &rhs) noexcept
 Compare a persistent_ptr with a null pointer.
 
template<typename T >
persistent_ptr< T > pmem::obj::operator+ (persistent_ptr< T > const &lhs, std::ptrdiff_t s)
 Addition operator for persistent pointers.
 
template<typename T >
persistent_ptr< T > pmem::obj::operator- (persistent_ptr< T > const &lhs, std::ptrdiff_t s)
 Subtraction operator for persistent pointers.
 
template<typename T , typename Y , typename = typename std::enable_if< std::is_same<typename std::remove_cv<T>::type, typename std::remove_cv<Y>::type>::value>>
ptrdiff_t pmem::obj::operator- (persistent_ptr< T > const &lhs, persistent_ptr< Y > const &rhs)
 Subtraction operator for persistent pointers of identical type. More...
 
template<typename T >
std::ostream & pmem::obj::operator<< (std::ostream &os, persistent_ptr< T > const &pptr)
 Ostream operator for the persistent pointer.
 

Detailed Description

Persistent smart pointer.

Function Documentation

◆ operator-()

template<typename T , typename Y , typename = typename std::enable_if< std::is_same<typename std::remove_cv<T>::type, typename std::remove_cv<Y>::type>::value>>
ptrdiff_t pmem::obj::operator- ( persistent_ptr< T > const &  lhs,
persistent_ptr< Y > const &  rhs 
)
inline

Subtraction operator for persistent pointers of identical type.

Calculates the offset difference of PMEMoids in terms of represented objects. Calculating the difference of pointers from objects of different pools is not allowed.

◆ operator<()

template<typename T , typename Y >
bool pmem::obj::operator< ( persistent_ptr< T > const &  lhs,
persistent_ptr< Y > const &  rhs 
)
inlinenoexcept

Less than operator.

Returns
true if the uuid_lo of lhs is less than the uuid_lo of rhs, should they be equal, the offsets are compared. Returns false otherwise.

◆ operator<=()

template<typename T , typename Y >
bool pmem::obj::operator<= ( persistent_ptr< T > const &  lhs,
persistent_ptr< Y > const &  rhs 
)
inlinenoexcept

Less or equal than operator.

See less than operator for comparison rules.

◆ operator==()

template<typename T , typename Y >
bool pmem::obj::operator== ( persistent_ptr< T > const &  lhs,
persistent_ptr< Y > const &  rhs 
)
inlinenoexcept

Equality operator.

This checks if underlying PMEMoids are equal.

◆ operator>()

template<typename T , typename Y >
bool pmem::obj::operator> ( persistent_ptr< T > const &  lhs,
persistent_ptr< Y > const &  rhs 
)
inlinenoexcept

Greater than operator.

See less than operator for comparison rules.

◆ operator>=()

template<typename T , typename Y >
bool pmem::obj::operator>= ( persistent_ptr< T > const &  lhs,
persistent_ptr< Y > const &  rhs 
)
inlinenoexcept

Greater or equal than operator.

See less than operator for comparison rules.

◆ swap()

template<class T >
void pmem::obj::swap ( persistent_ptr< T > &  a,
persistent_ptr< T > &  b 
)
inline

Swaps two persistent_ptr objects of the same type.

Non-member swap function as required by Swappable concept. en.cppreference.com/w/cpp/concept/Swappable