Kind of smart pointers:
This is the only reference pointer.
Takes an ownership of object or array of objects
Takes a partial ownership of object or array of objects by using extrusive reference-counting.
The same as Shared::Ptr but uses intrusive reference-counting.
It’s a specialization of the Intrusive::Ptr.
An adaptor that makes a base pointer a constant.
An adaptor that reverses the increment and decrement operation of the base pointer.
Operators/Functionality | Smart pointers | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Reference | Ownership | Adaptors | ||||||||||||||
Weak:: | Unique:: | Shared:: | TS::Shared:: |
Intrusive:: | Reference:: | Const:: | Reverse:: | |||||||||
Ptr<T> | Ptr<T[]> |
Ptr<T> | Ptr<T[]> |
Ptr<T> | Ptr<T[]> |
Ptr<T> | Ptr<T[]> |
Ptr<T> | Ptr<T> |
Ptr<T> | Ptr<T[]> |
Ptr<T> | Ptr<T[]> | |||
Optional template parameters | <…, Deleter> |
<…, Deleter, Counter, DynamicAllocator> |
<…, Adjuster> | |||||||||||||
Type | typename Ptr::Type | Base | ||||||||||||||
Construction | Ptr ptr(ptr’) Ptr ptr = ptr’ Ptr ptr(T*) Ptr ptr(null) Ptr ptr = null Ptr ptr(Ptr<U>(…)); Ptr ptr = Ptr<U>(…); |
Ptr ptr(…[, Deleter]) | Ptr ptr(…[, Deleter[, DynamicAlocator]]) | |||||||||||||
Destruction | ~Ptr() | *this = null | ||||||||||||||
Assignment | ptr = ptr’ | Copies a reference | Moves an object | Copyies an object’s reference and increments a counter | ||||||||||||
ptr = null | Releases a reference | Releases an object | if (0 == —counter) { releases an object } | |||||||||||||
Pointer Specific |
Dereference | *ptr | ||||||||||||||
Member access | ptr.operator→() | |||||||||||||||
Comparison |
Equal | ptr == ptr’ ptr == null null == ptr |
||||||||||||||
Not equal | ptr != ptr’ ptr != null null != ptr |
|||||||||||||||
Subcription | ptr [Int(index)] | |||||||||||||||
Arithmetic |
Addition | ptr + Int(index) | ||||||||||||||
Subtraction | ptr – Int(index) | |||||||||||||||
Incrementing | ptr++ ++ptr |
|||||||||||||||
Decrementing | ptr— —ptr |
|||||||||||||||
Compound assignment |
ptr += Int(index) ptr -= Int(index) |
|||||||||||||||
Relational |
Subtraction | ptr – ptr’ | ||||||||||||||
Greate than | ptr > ptr’ | |||||||||||||||
Greate than or equal to |
ptr >= ptr’ | |||||||||||||||
Less than | ptr < ptr’ | |||||||||||||||
Less than or equal to |
ptr <= ptr’ | |||||||||||||||
Particular |
Detaching | ptr.Weak() = null | ||||||||||||||
Ownership object (deleter) |
ptr.owner() | |||||||||||||||
Uniqueness | ptr.unique() |