48 using std::shared_ptr < T >::shared_ptr;
50 using std::shared_ptr < T >::operator =;
118 return this->
get ( );
128 return this->
get ( );
138 return * this->
get ( );
148 return * this->
get ( );
187 return std::shared_ptr < T >::use_count ( );
195 explicit operator bool( )
const {
205 void make_unique ( ) {
208 static_cast < std::shared_ptr < T > &
> ( * this ) = std::shared_ptr < T > (
ext::clone ( std::shared_ptr < T >::operator * ( ) ) );
219 std::swap (
static_cast < std::shared_ptr < T > &
> ( first ),
static_cast < std::shared_ptr < T > &
> (
second ) );
300 if (
this == & other )
return *
this;
317 swap ( this->m_Data, other.m_Data );
400 explicit operator bool( )
const {
401 return static_cast < bool > ( m_Data );
Specialisation of copy on write pointer for classes based with copy on write pointer base.
Definition: memory.hpp:46
void reset() noexcept
Sets the shared pointer to nullptr.
Definition: memory.hpp:96
cow_shared_ptr(cow_shared_ptr &&other) noexcept=default
Move constructor to create new instance of shared pointer reffering the same data.
T & operator*()
Operator dereference to access the inner managed pointer.
Definition: memory.hpp:137
T * get()
Definition: memory.hpp:156
bool unique() const
Tests whether the managed pointer is referenced from one location only (or the class stores null poin...
Definition: memory.hpp:176
friend void swap(cow_shared_ptr &first, cow_shared_ptr &second)
Specialisation of swap method to copy on write shared pointers.
Definition: memory.hpp:218
T const * get() const
Definition: memory.hpp:166
cow_shared_ptr(const cow_shared_ptr &other)=default
Copy constructor to create new instance of shared pointer reffering the same data.
unsigned use_count() const
Getter of the number how many times the managed pointer is referenced.
Definition: memory.hpp:186
void reset(Y *ptr)
Sets the shared pointer to value.
Definition: memory.hpp:107
T * operator->()
Operator arrow to chain dereferece to inner managed pointer.
Definition: memory.hpp:117
~cow_shared_ptr() noexcept=default
The destructor of the shared pointer.
Managed pointer simulating value like behavior.
Definition: memory.hpp:233
smart_ptr(smart_ptr &&other) noexcept
Move constructor of the smart pointer. Passes ownership of the managed resource from source to constr...
Definition: memory.hpp:282
smart_ptr()
Default initialization to null.
Definition: memory.hpp:245
T * operator->()
Operator arrow to chain dereferece to inner managed pointer.
Definition: memory.hpp:327
smart_ptr(const smart_ptr &other)
Copy constructor of the smart pointer. Internally uses clone (if available) or copy constructor of th...
Definition: memory.hpp:273
smart_ptr(T *data)
Constructor which takes ownership of the provided pointer.
Definition: memory.hpp:252
T * get() const
Getter of the raw managed pointer.
Definition: memory.hpp:377
~smart_ptr() noexcept
The destructor of the shared pointer, responsible for freeing the managed resource.
Definition: memory.hpp:289
T & operator*()
Operator dereference to access the inner managed pointer.
Definition: memory.hpp:347
smart_ptr(smart_ptr< R > other)
Conversion constructor to simplify type casting.
Definition: memory.hpp:264
T * release()
Releases the shared resource and returns it.
Definition: memory.hpp:387
T * get()
Getter of the raw managed pointer.
Definition: memory.hpp:367
smart_ptr & operator=(const smart_ptr &other)
Copy operator of assignment. Internally uses clone (if available) or copy constructor of the managed ...
Definition: memory.hpp:299
p second
Definition: ToRegExpAlgebraic.h:126
return res
Definition: MinimizeByPartitioning.h:145
Definition: sigHandler.cpp:20
ForwardIterator unique(ForwardIterator first, ForwardIterator last)
Shuffles values in a sequece so that consecutive duplicate values are pushed to the front and others ...
Definition: algorithm.hpp:384
auto clone(T &&tmp)
Wrapper around clone by means of using copy constructor or clone method if available.
Definition: clone.hpp:41
std::ostream & operator<<(ext::reference_wrapper< std::ostream > &os, std::ostream &(*const func)(std::ostream &))
Overloaded function allowing same operations on wrapped output stream as on the actual output stream,...
Definition: GlobalData.cpp:33
void swap(ext::linear_set< T, Compare, Alloc > &x, ext::linear_set< T, Compare, Alloc > &y)
Specialisation of swap for linear set.
Definition: linear_set.hpp:846
void reset()
Definition: measurements.cpp:24
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
void swap(ext::managed_linear_set< T, Compare, Alloc > &x, ext::managed_linear_set< T, Compare, Alloc > &y)
Specialisation of swap for linear set.
Definition: managed_linear_set.hpp:864