PMDK C++ bindings  1.9.1
This is the C++ bindings documentation for PMDK's libpmemobj.
persistent_ptr.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2021, Intel Corporation
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  *
16  * * Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
38 #ifndef LIBPMEMOBJ_CPP_PERSISTENT_PTR_HPP
39 #define LIBPMEMOBJ_CPP_PERSISTENT_PTR_HPP
40 
41 #include <cassert>
42 #include <limits>
43 #include <memory>
44 #include <ostream>
45 
49 #include <libpmemobj++/pool.hpp>
50 #include <libpmemobj/base.h>
51 
52 namespace pmem
53 {
54 
55 namespace obj
56 {
57 
58 template <typename T>
59 class pool;
60 
61 template <typename T>
62 class persistent_ptr;
63 
70 template <>
71 class persistent_ptr<void> : public persistent_ptr_base {
72 public:
73  typedef void element_type;
75 
76  persistent_ptr() = default;
78  persistent_ptr(void *ptr) : persistent_ptr_base(pmemobj_oid(ptr))
79  {
80  }
81 
82  element_type *
83  get() const noexcept
84  {
85  if (this->oid.pool_uuid_lo ==
86  std::numeric_limits<decltype(oid.pool_uuid_lo)>::max())
87  return reinterpret_cast<element_type *>(oid.off);
88  else
89  return static_cast<element_type *>(
90  pmemobj_direct(this->oid));
91  }
92 
93  template <typename Y,
94  typename = typename std::enable_if<
95  std::is_convertible<Y *, void *>::value>::type>
98  {
99  this_type(r).swap(*this);
100 
101  return *this;
102  }
103 
104  explicit operator bool() const noexcept
105  {
106  return get() != nullptr;
107  }
108 };
109 
116 template <>
117 class persistent_ptr<const void> : public persistent_ptr_base {
118 public:
119  typedef const void element_type;
121 
122  persistent_ptr() = default;
124  persistent_ptr(const void *ptr) : persistent_ptr_base(pmemobj_oid(ptr))
125  {
126  }
127 
128  element_type *
129  get() const noexcept
130  {
131  if (this->oid.pool_uuid_lo ==
132  std::numeric_limits<decltype(oid.pool_uuid_lo)>::max())
133  return reinterpret_cast<element_type *>(oid.off);
134  else
135  return static_cast<element_type *>(
136  pmemobj_direct(this->oid));
137  }
138 
139  template <typename Y,
140  typename = typename std::enable_if<
141  std::is_convertible<Y *, const void *>::value>::type>
144  {
145  this_type(r).swap(*this);
146 
147  return *this;
148  }
149 
150  explicit operator bool() const noexcept
151  {
152  return get() != nullptr;
153  }
154 };
155 
211 template <typename T>
213 public:
215 
216  template <typename U>
217  friend class persistent_ptr;
218 
223  typedef typename pmem::detail::sp_element<T>::type element_type;
224 
225  persistent_ptr() = default;
227 
228  /*
229  * Constructors
230  */
231 
235  explicit persistent_ptr(persistent_ptr<void> const &rhs) noexcept
236  : persistent_ptr_base(rhs.raw())
237  {
238  }
239 
243  explicit persistent_ptr(persistent_ptr<const void> const &rhs) noexcept
244  : persistent_ptr_base(rhs.raw())
245  {
246  }
247 
257  : persistent_ptr_base(pmemobj_oid(ptr))
258  {
259  verify_type();
260  }
261 
267  template <typename U,
268  typename = typename std::enable_if<
269  !std::is_same<T, U>::value &&
270  std::is_same<typename std::remove_cv<T>::type,
271  U>::value>::type>
273  : persistent_ptr_base(r.oid)
274  {
275  this->oid.off +=
276  static_cast<std::uint64_t>(calculate_offset<U>());
277  verify_type();
278  }
279 
285  template <
286  typename U, typename Dummy = void,
287  typename = typename std::enable_if<
288  !std::is_same<
289  typename std::remove_cv<T>::type,
290  typename std::remove_cv<U>::type>::value &&
291  !std::is_void<U>::value,
292  decltype(static_cast<T *>(std::declval<U *>()))>::type>
294  : persistent_ptr_base(r.oid)
295  {
296  this->oid.off +=
297  static_cast<std::uint64_t>(calculate_offset<U>());
298  verify_type();
299  }
300 
301  /*
302  * Operators
303  */
304 
308  operator persistent_ptr<void>() const noexcept
309  {
310  return this->get();
311  }
312 
316  typename pmem::detail::sp_dereference<T>::type operator*() const
317  noexcept
318  {
319  return *this->get();
320  }
321 
325  typename pmem::detail::sp_member_access<T>::type operator->() const
326  noexcept
327  {
328  return this->get();
329  }
330 
336  template <typename = typename std::enable_if<!std::is_void<T>::value>>
337  typename pmem::detail::sp_array_access<T>::type
338  operator[](std::ptrdiff_t i) const noexcept
339  {
340  assert(i >= 0 &&
341  (i < pmem::detail::sp_extent<T>::value ||
342  pmem::detail::sp_extent<T>::value == 0) &&
343  "persistent array index out of bounds");
344 
345  return this->get()[i];
346  }
347 
351  inline persistent_ptr<T> &
353  {
354  detail::conditional_add_to_tx(this);
355  this->oid.off += sizeof(T);
356 
357  return *this;
358  }
359 
363  inline persistent_ptr<T>
365  {
366  PMEMoid noid = this->oid;
367  ++(*this);
368 
369  return persistent_ptr<T>(noid);
370  }
371 
375  inline persistent_ptr<T> &
377  {
378  detail::conditional_add_to_tx(this);
379  this->oid.off -= sizeof(T);
380 
381  return *this;
382  }
383 
387  inline persistent_ptr<T>
389  {
390  PMEMoid noid = this->oid;
391  --(*this);
392 
393  return persistent_ptr<T>(noid);
394  }
395 
399  inline persistent_ptr<T> &
400  operator+=(std::ptrdiff_t s)
401  {
402  detail::conditional_add_to_tx(this);
403  this->oid.off += static_cast<std::uint64_t>(s) * sizeof(T);
404 
405  return *this;
406  }
407 
411  inline persistent_ptr<T> &
412  operator-=(std::ptrdiff_t s)
413  {
414  detail::conditional_add_to_tx(this);
415  this->oid.off -= static_cast<std::uint64_t>(s) * sizeof(T);
416 
417  return *this;
418  }
419 
431  template <typename Y,
432  typename = typename std::enable_if<
433  std::is_convertible<Y *, T *>::value>::type>
436  {
437  this_type(r).swap(*this);
438 
439  return *this;
440  }
441 
442  /*
443  * Bool conversion operator.
444  */
445  explicit operator bool() const noexcept
446  {
447  return get() != nullptr;
448  }
449 
450  /*
451  * Persist/flush methods
452  */
453 
459  void
461  {
462  pop.persist(this->get(), sizeof(T));
463  }
464 
471  void
472  persist(void)
473  {
474  pmemobjpool *pop = pmemobj_pool_by_oid(this->raw());
475 
476  if (pop == nullptr)
477  throw pmem::pool_error(
478  "Cannot get pool from persistent pointer");
479 
480  pmemobj_persist(pop, this->get(), sizeof(T));
481  }
482 
488  void
490  {
491  pop.flush(this->get(), sizeof(T));
492  }
493 
500  void
501  flush(void)
502  {
503  pmemobjpool *pop = pmemobj_pool_by_oid(this->raw());
504 
505  if (pop == nullptr)
506  throw pmem::pool_error(
507  "Cannot get pool from persistent pointer");
508 
509  pmemobj_flush(pop, this->get(), sizeof(T));
510  }
511 
512  /*
513  * Pointer traits related.
514  */
515 
524  static persistent_ptr<T>
525  pointer_to(T &ref)
526  {
527  return persistent_ptr<T>(std::addressof(ref), 0);
528  }
529 
537  element_type *
538  get() const noexcept
539  {
540  if (this->oid.pool_uuid_lo ==
541  std::numeric_limits<decltype(oid.pool_uuid_lo)>::max())
542  return reinterpret_cast<element_type *>(oid.off);
543  else
544  return static_cast<element_type *>(
545  pmemobj_direct(this->oid));
546  }
547 
551  template <class U>
553 
558 
562  using bool_type = bool;
563 
571  using iterator_category = std::random_access_iterator_tag;
572 
576  using difference_type = std::ptrdiff_t;
577 
581  using value_type = T;
582 
586  using reference = T &;
587 
592 
593 protected:
597  void
599  {
600  static_assert(!std::is_polymorphic<element_type>::value,
601  "Polymorphic types are not supported");
602  }
603 
612  {
613  if (OID_IS_NULL(oid)) {
614  oid.pool_uuid_lo = std::numeric_limits<decltype(
615  oid.pool_uuid_lo)>::max();
616  oid.off = reinterpret_cast<decltype(oid.off)>(vptr);
617  }
618  }
619 
635  template <typename U>
636  inline ptrdiff_t
638  {
639  static const ptrdiff_t ptr_offset_magic = 0xF00000000000000;
640 
641  static_assert(ptr_offset_magic % alignof(U) == 0, "");
642  static_assert(ptr_offset_magic % alignof(T) == 0, "");
643 
644  U *tmp{reinterpret_cast<U *>(ptr_offset_magic)};
645  T *diff = static_cast<T *>(tmp);
646  return reinterpret_cast<ptrdiff_t>(diff) -
647  reinterpret_cast<ptrdiff_t>(tmp);
648  }
649 };
650 
657 template <class T>
658 inline void
660 {
661  a.swap(b);
662 }
663 
669 template <typename T, typename Y>
670 inline bool
671 operator==(persistent_ptr<T> const &lhs, persistent_ptr<Y> const &rhs) noexcept
672 {
673  return OID_EQUALS(lhs.raw(), rhs.raw());
674 }
675 
679 template <typename T, typename Y>
680 inline bool
681 operator!=(persistent_ptr<T> const &lhs, persistent_ptr<Y> const &rhs) noexcept
682 {
683  return !(lhs == rhs);
684 }
685 
689 template <typename T>
690 inline bool
691 operator==(persistent_ptr<T> const &lhs, std::nullptr_t) noexcept
692 {
693  return lhs.get() == nullptr;
694 }
695 
699 template <typename T>
700 inline bool
701 operator==(std::nullptr_t, persistent_ptr<T> const &lhs) noexcept
702 {
703  return lhs.get() == nullptr;
704 }
705 
709 template <typename T>
710 inline bool
711 operator!=(persistent_ptr<T> const &lhs, std::nullptr_t) noexcept
712 {
713  return lhs.get() != nullptr;
714 }
715 
719 template <typename T>
720 inline bool
721 operator!=(std::nullptr_t, persistent_ptr<T> const &lhs) noexcept
722 {
723  return lhs.get() != nullptr;
724 }
725 
733 template <typename T, typename Y>
734 inline bool
735 operator<(persistent_ptr<T> const &lhs, persistent_ptr<Y> const &rhs) noexcept
736 {
737  if (lhs.raw().pool_uuid_lo == rhs.raw().pool_uuid_lo)
738  return lhs.raw().off < rhs.raw().off;
739  else
740  return lhs.raw().pool_uuid_lo < rhs.raw().pool_uuid_lo;
741 }
742 
748 template <typename T, typename Y>
749 inline bool
750 operator<=(persistent_ptr<T> const &lhs, persistent_ptr<Y> const &rhs) noexcept
751 {
752  return !(rhs < lhs);
753 }
754 
760 template <typename T, typename Y>
761 inline bool
762 operator>(persistent_ptr<T> const &lhs, persistent_ptr<Y> const &rhs) noexcept
763 {
764  return (rhs < lhs);
765 }
766 
772 template <typename T, typename Y>
773 inline bool
774 operator>=(persistent_ptr<T> const &lhs, persistent_ptr<Y> const &rhs) noexcept
775 {
776  return !(lhs < rhs);
777 }
778 
779 /* nullptr comparisons */
780 
784 template <typename T>
785 inline bool
786 operator<(persistent_ptr<T> const &lhs, std::nullptr_t) noexcept
787 {
788  return std::less<typename persistent_ptr<T>::element_type *>()(
789  lhs.get(), nullptr);
790 }
791 
795 template <typename T>
796 inline bool
797 operator<(std::nullptr_t, persistent_ptr<T> const &rhs) noexcept
798 {
799  return std::less<typename persistent_ptr<T>::element_type *>()(
800  nullptr, rhs.get());
801 }
802 
806 template <typename T>
807 inline bool
808 operator<=(persistent_ptr<T> const &lhs, std::nullptr_t) noexcept
809 {
810  return !(nullptr < lhs);
811 }
812 
816 template <typename T>
817 inline bool
818 operator<=(std::nullptr_t, persistent_ptr<T> const &rhs) noexcept
819 {
820  return !(rhs < nullptr);
821 }
822 
826 template <typename T>
827 inline bool
828 operator>(persistent_ptr<T> const &lhs, std::nullptr_t) noexcept
829 {
830  return nullptr < lhs;
831 }
832 
836 template <typename T>
837 inline bool
838 operator>(std::nullptr_t, persistent_ptr<T> const &rhs) noexcept
839 {
840  return rhs < nullptr;
841 }
842 
846 template <typename T>
847 inline bool
848 operator>=(persistent_ptr<T> const &lhs, std::nullptr_t) noexcept
849 {
850  return !(lhs < nullptr);
851 }
852 
856 template <typename T>
857 inline bool
858 operator>=(std::nullptr_t, persistent_ptr<T> const &rhs) noexcept
859 {
860  return !(nullptr < rhs);
861 }
862 
866 template <typename T>
867 inline persistent_ptr<T>
868 operator+(persistent_ptr<T> const &lhs, std::ptrdiff_t s)
869 {
870  PMEMoid noid;
871  noid.pool_uuid_lo = lhs.raw().pool_uuid_lo;
872  noid.off = lhs.raw().off + static_cast<std::uint64_t>(s) * sizeof(T);
873 
874  return persistent_ptr<T>(noid);
875 }
876 
880 template <typename T>
881 inline persistent_ptr<T>
882 operator-(persistent_ptr<T> const &lhs, std::ptrdiff_t s)
883 {
884  PMEMoid noid;
885  noid.pool_uuid_lo = lhs.raw().pool_uuid_lo;
886  noid.off = lhs.raw().off - static_cast<std::uint64_t>(s) * sizeof(T);
887 
888  return persistent_ptr<T>(noid);
889 }
890 
898 template <typename T, typename Y,
899  typename = typename std::enable_if<
900  std::is_same<typename std::remove_cv<T>::type,
901  typename std::remove_cv<Y>::type>::value>>
902 inline ptrdiff_t
904 {
905  assert(lhs.raw().pool_uuid_lo == rhs.raw().pool_uuid_lo);
906  auto d = static_cast<std::ptrdiff_t>(lhs.raw().off - rhs.raw().off);
907 
908  return d / static_cast<std::ptrdiff_t>(sizeof(T));
909 }
910 
914 template <typename T>
915 std::ostream &
916 operator<<(std::ostream &os, persistent_ptr<T> const &pptr)
917 {
918  PMEMoid raw_oid = pptr.raw();
919  os << std::hex << "0x" << raw_oid.pool_uuid_lo << ", 0x" << raw_oid.off
920  << std::dec;
921  return os;
922 }
923 
924 } /* namespace obj */
925 
926 } /* namespace pmem */
927 
928 #endif /* LIBPMEMOBJ_CPP_PERSISTENT_PTR_HPP */
pmem::obj::persistent_ptr< T[]>::difference_type
std::ptrdiff_t difference_type
The persistent_ptr difference type.
Definition: persistent_ptr.hpp:576
pmem::obj::operator+
persistent_ptr< T > operator+(persistent_ptr< T > const &lhs, std::ptrdiff_t s)
Addition operator for persistent pointers.
Definition: persistent_ptr.hpp:868
pmem::obj::persistent_ptr::get
element_type * get() const noexcept
Get the direct pointer.
Definition: persistent_ptr.hpp:538
pmem::obj::persistent_ptr< T[]>::reference
T & reference
The reference type of the value pointed to by the persistent_ptr.
Definition: persistent_ptr.hpp:586
pmem::obj::persistent_ptr::calculate_offset
ptrdiff_t calculate_offset() const
Calculate in-object offset for structures with inheritance.
Definition: persistent_ptr.hpp:637
pmem::obj::persistent_ptr::persistent_ptr
persistent_ptr(persistent_ptr< U > const &r) noexcept
Copy constructor from a different persistent_ptr<>.
Definition: persistent_ptr.hpp:272
pmem::pool_error
Custom pool error class.
Definition: pexceptions.hpp:76
pmem::obj::persistent_ptr::flush
void flush(void)
Flushes what the persistent pointer points to.
Definition: persistent_ptr.hpp:501
pmem::obj::pool_base::persist
void persist(const void *addr, size_t len) noexcept
Performs persist operation on a given chunk of memory.
Definition: pool.hpp:312
pmem
Persistent memory namespace.
Definition: allocation_flag.hpp:44
pmem::obj::persistent_ptr< const void >
persistent_ptr const void specialization.
Definition: persistent_ptr.hpp:117
pmem::obj::persistent_ptr< T[]>::value_type
T value_type
The type of the value pointed to by the persistent_ptr.
Definition: persistent_ptr.hpp:581
pmem::obj::persistent_ptr< T[]>::iterator_category
std::random_access_iterator_tag iterator_category
Random access iterator requirements (members)
Definition: persistent_ptr.hpp:571
common.hpp
Commonly used functionality.
pmem::obj::persistent_ptr::operator--
persistent_ptr< T > & operator--()
Prefix decrement operator.
Definition: persistent_ptr.hpp:376
pmem::obj::operator>
bool operator>(const array< T, N > &lhs, const array< T, N > &rhs)
Non-member greater than operator.
Definition: array.hpp:763
pmem::obj::persistent_ptr::operator++
persistent_ptr< T > operator++(int)
Postfix increment operator.
Definition: persistent_ptr.hpp:364
pmem::obj::persistent_ptr::persist
void persist(void)
Persists what the persistent pointer points to.
Definition: persistent_ptr.hpp:472
pmem::obj::persistent_ptr::pointer_to
static persistent_ptr< T > pointer_to(T &ref)
Create a persistent pointer from a given reference.
Definition: persistent_ptr.hpp:525
pmem::obj::persistent_ptr::operator--
persistent_ptr< T > operator--(int)
Postfix decrement operator.
Definition: persistent_ptr.hpp:388
pmem::obj::persistent_ptr_base::swap
void swap(persistent_ptr_base &other)
Swaps two persistent_ptr objects of the same type.
Definition: persistent_ptr_base.hpp:165
pmem::obj::operator>=
bool operator>=(const array< T, N > &lhs, const array< T, N > &rhs)
Non-member greater or equal operator.
Definition: array.hpp:773
pmem::obj::operator==
bool operator==(standard_alloc_policy< T > const &, standard_alloc_policy< T2 > const &)
Determines if memory from another allocator can be deallocated from this one.
Definition: allocator.hpp:402
pmem::obj::persistent_ptr::operator->
pmem::detail::sp_member_access< T >::type operator->() const noexcept
Member access operator.
Definition: persistent_ptr.hpp:325
pmem::obj::persistent_ptr::persistent_ptr
persistent_ptr(persistent_ptr< U > const &r) noexcept
Copy constructor from a different persistent_ptr<>.
Definition: persistent_ptr.hpp:293
pmem::obj::p
Resides on pmem class.
Definition: p.hpp:64
pmem::obj::operator<<
std::ostream & operator<<(std::ostream &os, persistent_ptr< T > const &pptr)
Ostream operator for the persistent pointer.
Definition: persistent_ptr.hpp:916
pmem::obj::persistent_ptr::persistent_ptr
persistent_ptr(persistent_ptr< void > const &rhs) noexcept
Explicit void specialization of the converting constructor.
Definition: persistent_ptr.hpp:235
pmem::obj::persistent_ptr::operator-=
persistent_ptr< T > & operator-=(std::ptrdiff_t s)
Subtraction assignment operator.
Definition: persistent_ptr.hpp:412
pmem::obj::persistent_ptr::operator*
pmem::detail::sp_dereference< T >::type operator*() const noexcept
Dereference operator.
Definition: persistent_ptr.hpp:316
pmem::obj::persistent_ptr::operator++
persistent_ptr< T > & operator++()
Prefix increment operator.
Definition: persistent_ptr.hpp:352
pmem::obj::persistent_ptr::persistent_ptr_base
persistent_ptr_base() noexcept
Default constructor, zeroes the PMEMoid.
Definition: persistent_ptr_base.hpp:76
pool.hpp
C++ pmemobj pool.
pmem::obj::persistent_ptr< void >
persistent_ptr void specialization.
Definition: persistent_ptr.hpp:71
pmem::obj::operator-
persistent_ptr< T > operator-(persistent_ptr< T > const &lhs, std::ptrdiff_t s)
Subtraction operator for persistent pointers.
Definition: persistent_ptr.hpp:882
pmem::obj::swap
void swap(pmem::obj::array< T, N > &lhs, pmem::obj::array< T, N > &rhs)
Non-member swap function.
Definition: array.hpp:913
pmem::obj::operator!=
bool operator!=(const allocator< T, P, Tr > &lhs, const OtherAllocator &rhs)
Determines if memory from another allocator can be deallocated from this one.
Definition: allocator.hpp:518
pmem::obj::persistent_ptr::persist
void persist(pool_base &pop)
Persists the content of the underlying object.
Definition: persistent_ptr.hpp:460
specialization.hpp
Helper template for persistent ptr specialization.
pmem::obj::persistent_ptr::element_type
pmem::detail::sp_element< T >::type element_type
Type of the actual object with all qualifiers removed, used for easy underlying type access.
Definition: persistent_ptr.hpp:223
pmem::obj::pool_base::flush
void flush(const void *addr, size_t len) noexcept
Performs flush operation on a given chunk of memory.
Definition: pool.hpp:349
pmem::obj::persistent_ptr< T[]>::bool_type
bool bool_type
The used bool_type.
Definition: persistent_ptr.hpp:562
pmem::obj::persistent_ptr
Persistent pointer class.
Definition: persistent_ptr.hpp:212
pmem::obj::persistent_ptr::flush
void flush(pool_base &pop)
Flushes what the persistent pointer points to.
Definition: persistent_ptr.hpp:489
pmem::obj::operator<
bool operator<(const array< T, N > &lhs, const array< T, N > &rhs)
Non-member less than operator.
Definition: array.hpp:752
pmem::obj::persistent_ptr::operator+=
persistent_ptr< T > & operator+=(std::ptrdiff_t s)
Addition assignment operator.
Definition: persistent_ptr.hpp:400
pmem::obj::persistent_ptr::verify_type
void verify_type()
Verify if element_type is not polymorphic.
Definition: persistent_ptr.hpp:598
pmem::obj::operator<=
bool operator<=(const array< T, N > &lhs, const array< T, N > &rhs)
Non-member less or equal operator.
Definition: array.hpp:783
pmem::obj::persistent_ptr::persistent_ptr
persistent_ptr(element_type *vptr, int)
Private constructor enabling persistent_ptrs to volatile objects.
Definition: persistent_ptr.hpp:611
pmem::obj::persistent_ptr::persistent_ptr
persistent_ptr(persistent_ptr< const void > const &rhs) noexcept
Explicit const void specialization of the converting constructor.
Definition: persistent_ptr.hpp:243
pmem::obj::persistent_ptr_base
Persistent_ptr base (non-template) class.
Definition: persistent_ptr_base.hpp:71
pmem::obj::persistent_ptr::persistent_ptr
persistent_ptr(element_type *ptr)
Volatile pointer constructor.
Definition: persistent_ptr.hpp:256
persistent_ptr_base.hpp
Base class for persistent_ptr.
pmem::obj::pool_base
The non-template pool base class.
Definition: pool.hpp:75
pmem::obj::persistent_ptr::operator=
persistent_ptr< T > & operator=(persistent_ptr< Y > const &r)
Converting assignment operator from a different persistent_ptr<>.
Definition: persistent_ptr.hpp:435
pmem::obj::persistent_ptr_base::persistent_ptr_base
persistent_ptr_base() noexcept
Default constructor, zeroes the PMEMoid.
Definition: persistent_ptr_base.hpp:76
pmem::obj::persistent_ptr::operator[]
pmem::detail::sp_array_access< T >::type operator[](std::ptrdiff_t i) const noexcept
Array access operator.
Definition: persistent_ptr.hpp:338