146 #if defined(EVO_CPP11) 271 #if defined(EVO_CPP11) 398 template<
class T,
class TSize=SizeT>
409 {
ptr_ = NULL; refs_ = NULL; }
418 {
ptr_ =
ptr; refs_ =
new TSize; *refs_ = 1; }
420 {
ptr_ = NULL; refs_ = NULL; }
429 if (src.
ptr_ != NULL)
432 {
ptr_ = NULL; refs_ = NULL; }
448 if (src.
ptr_ != NULL)
451 {
ptr_ = NULL; refs_ = NULL; }
473 #if defined(EVO_CPP11) 526 if (
ptr_ != NULL && *refs_ > 1) {
539 {
return (
ptr_ != NULL && *refs_ > 1); }
547 {
delete ptr_;
delete refs_; }
548 }
else if (refs_ != NULL)
609 template<
class T,
class TSize>
620 {
ptr_ = NULL; refs_ = NULL; }
629 {
ptr_ =
ptr; refs_ =
new TSize; *refs_ = 1; }
631 {
ptr_ = NULL; refs_ = NULL; }
640 if (src.
ptr_ != NULL)
643 {
ptr_ = NULL; refs_ = NULL; }
659 if (src.
ptr_ != NULL)
662 {
ptr_ = NULL; refs_ = NULL; }
684 #if defined(EVO_CPP11) 716 if (--(*refs_) == 0) {
735 {
return (
ptr_ != NULL && *refs_ > 1); }
743 {
delete []
ptr_;
delete refs_; }
744 }
else if (refs_ != NULL)
870 #if defined(EVO_CPP11) 1026 {
ptr_ = (T*)ptr;
return *
this; }
1028 #if defined(EVO_CPP11) 1052 {
ptr_ = NULL;
return *
this; }
1058 {
ptr_ = NULL;
return *
this; }
This & operator=(This &&src)
Move assignment operator (C++11).
Definition: ptr.h:699
SmartPtr(const This &src)
Copy constructor.
Definition: ptr.h:114
Check if type is a SmartPtr or SharedPtr.
Definition: ptr.h:1093
This & clear()
Clear (free) pointer and set as null.
Definition: ptr.h:295
Ptr(const T *ptr)
Constructor.
Definition: ptr.h:985
T Item
Item type dereferenced to.
Definition: ptr.h:99
This & operator=(const Base &src)
Assignment operator to reference pointer.
Definition: ptr.h:847
This & operator=(T *ptr)
Assignment operator for new pointer.
Definition: ptr.h:265
Ptr< T[]> This
This pointer type.
Definition: ptr.h:967
This & operator=(This &&src)
Move assignment operator (C++11).
Definition: ptr.h:883
Ptr(T *ptr)
Constructor.
Definition: ptr.h:979
Static bool value.
Definition: meta.h:111
T * detach()
Detach and return pointer.
Definition: ptr.h:911
This & operator=(T *ptr)
Assignment operator for new pointer.
Definition: ptr.h:140
TSize * refs_
Definition: ptr.h:542
SharedPtr(const This &src)
Copy constructor.
Definition: ptr.h:428
This & operator=(const T *ptr)
Assignment operator for raw pointer.
Definition: ptr.h:1025
SharedPtr(T *ptr)
Constructor.
Definition: ptr.h:416
This & operator=(const This &src)
Copy/Assignment operator.
Definition: ptr.h:657
SmartPtr< T[]> This
Definition: ptr.h:246
T Item
Definition: ptr.h:616
SmartPtr(T *ptr=NULL)
Constructor.
Definition: ptr.h:104
TSize * refs_
Definition: ptr.h:738
Ptr(T *ptr)
Constructor.
Definition: ptr.h:813
This & operator=(T *ptr)
Assignment operator for new pointer.
Definition: ptr.h:462
PtrBase< T > Base
Base type.
Definition: ptr.h:803
T * detach()
Detach and return pointer.
Definition: ptr.h:1065
#define EVO_ONCPP11(EXPR)
Compile EXPR only if C++11 support is detected, otherwise this is a no-op.
Definition: sys.h:259
Shared smart pointer to array.
Definition: ptr.h:610
SharedPtr(T *ptr)
Constructor.
Definition: ptr.h:627
const T * ptr() const
Get current pointer (const).
Definition: type.h:1735
Ptr(This &&src)
Move constructor (C++11).
Definition: ptr.h:874
This & clear()
Clear pointer, setting as null.
Definition: ptr.h:893
This & operator=(T *ptr)
Assignment operator for new pointer.
Definition: ptr.h:673
Smart pointer to array.
Definition: ptr.h:241
This & operator=(This &&src)
Move assignment operator (C++11).
Definition: ptr.h:284
T Item
Definition: ptr.h:247
void free()
Definition: ptr.h:544
This & clear()
Clear (free) pointer and set as null.
Definition: ptr.h:170
This & clear()
Release pointer and set as null.
Definition: ptr.h:714
SharedPtr()
Constructor to start with null pointer.
Definition: ptr.h:619
Ptr()
Default constructor sets as NULL.
Definition: ptr.h:807
SmartPtr(T *ptr=NULL)
Constructor.
Definition: ptr.h:252
Ptr(const Base &src)
Copy constructor to reference pointer.
Definition: ptr.h:997
T * detach()
Detach and return pointer.
Definition: ptr.h:190
SharedPtr(This &&src)
Move constructor (C++11).
Definition: ptr.h:477
~SharedPtr()
Destructor.
Definition: ptr.h:647
T Item
Item type dereferenced to.
Definition: ptr.h:804
This & operator=(This &&src)
Move assignment operator (C++11).
Definition: ptr.h:1041
T Item
Item type dereferenced to.
Definition: ptr.h:969
Ptr< T > This
This pointer type.
Definition: ptr.h:802
SmartPtr(This &&src)
Move constructor (C++11).
Definition: ptr.h:275
bool shared() const
Get whether pointer is shared (reference count > 1).
Definition: ptr.h:538
This & operator=(This &&src)
Move assignment operator (C++11).
Definition: ptr.h:159
~SharedPtr()
Destructor.
Definition: ptr.h:436
void free()
Definition: ptr.h:740
This & operator=(This &&src)
Move assignment operator (C++11).
Definition: ptr.h:488
~SmartPtr()
Destructor.
Definition: ptr.h:119
This & operator=(const This &src)
Copy/Assignment operator.
Definition: ptr.h:446
This & operator=(const This &src)
Copy/Assignment operator.
Definition: ptr.h:130
This & operator=(const This &src)
Copy/Assignment operator.
Definition: ptr.h:838
SharedPtr(This &&src)
Move constructor (C++11).
Definition: ptr.h:688
This & clear()
Release pointer and set as null.
Definition: ptr.h:503
Dumb pointer to array.
Definition: ptr.h:962
SmartPtr(This &&src)
Move constructor (C++11).
Definition: ptr.h:150
T Item
Item type dereferenced to.
Definition: ptr.h:405
SharedPtr< T, TSize > This
This pointer type.
Definition: ptr.h:404
This & operator=(const This &src)
Copy/Assignment operator.
Definition: ptr.h:1004
bool shared() const
Get whether pointer is shared (reference count > 1).
Definition: ptr.h:734
Evo C++ Library namespace.
Definition: alg.h:11
Ptr(const This &src)
Copy constructor.
Definition: ptr.h:825
Ptr()
Default constructor sets as NULL.
Definition: ptr.h:973
This & clear()
Clear pointer, setting as null.
Definition: ptr.h:1051
Ptr(const This &src)
Copy constructor.
Definition: ptr.h:991
SharedPtr(const This &src)
Copy constructor.
Definition: ptr.h:639
This & unshare()
Unshare pointer by setting as a new copy, if shared.
Definition: ptr.h:525
Ptr(const T *ptr)
Constructor.
Definition: ptr.h:819
This & operator=(T *ptr)
Assignment operator for raw pointer.
Definition: ptr.h:856
SharedPtr()
Constructor to start with null pointer.
Definition: ptr.h:408
T * ptr_
Pointer.
Definition: type.h:1566
Smart pointer to single object.
Definition: ptr.h:93
Shared smart pointer to single object.
Definition: ptr.h:399
PtrBase< T > Base
Base type.
Definition: ptr.h:968
void free()
Definition: ptr.h:322
SmartPtr< T > This
This pointer type.
Definition: ptr.h:98
SharedPtr< T[], TSize > This
Definition: ptr.h:615
This & operator=(T *ptr)
Assignment operator for raw pointer.
Definition: ptr.h:1018
void free()
Definition: ptr.h:197
Base managed pointer.
Definition: type.h:1562
~SmartPtr()
Destructor.
Definition: ptr.h:257
T * detach()
Detach and return pointer.
Definition: ptr.h:315
Ptr(const Base &src)
Copy constructor to reference pointer.
Definition: ptr.h:831
This & operator=(const T *ptr)
Assignment operator for raw pointer.
Definition: ptr.h:865
Evo basic types and traits.
This & operator=(const Base &src)
Assignment operator to reference pointer.
Definition: ptr.h:1011
Ptr(This &&src)
Move constructor (C++11).
Definition: ptr.h:1032
Dumb pointer to single object.
Definition: ptr.h:797