|
Cpp Utilities 1.2.3
|
Proxy class for operator[] in SafeSharedPtr, behave like array element of underlying array object, and provide RAII read-write lock for thread safety. More...
#include <SafeSharedPtr.hpp>
Public Types | |
| using | element_type = std::remove_extent_t< T > |
Element type of array T. More... | |
| using | pointer = element_type * |
| Pointer type of element. More... | |
| using | const_pointer = const element_type * |
| Const pointer type of element. More... | |
| using | reference = element_type & |
| Reference type of element. More... | |
| using | const_reference = const element_type & |
| Const eference type of element. More... | |
Public Member Functions | |
| ArrayHelper (const SafeSharedPtr &p, std::ptrdiff_t idx) | |
| Constructor a constant ArrayHelper to gain access to element of object managed by SafeSharedPtr. More... | |
| ArrayHelper (ArrayHelper &&other) noexcept | |
| Move constructor, transport ownership to another ArrayHelper, keep existing lock state. More... | |
| ~ArrayHelper () | |
| Destructor, release Lock if exists. More... | |
| ArrayHelper & | operator= (ArrayHelper &&other) |
| Move assigment, transport ownership to another ArrayHelper, keep existing lock state. More... | |
| operator reference () | |
Operator overload to act as element_type&. More... | |
| operator const_reference () const | |
Operator overload to act as const element_type&. More... | |
| template<typename X > | |
| ArrayHelper & | operator= (const X &other) |
| Assign operator to assign from another value. More... | |
Proxy class for operator[] in SafeSharedPtr, behave like array element of underlying array object, and provide RAII read-write lock for thread safety.
| Lock | Lock type used for protect the object. |
std::move with move constructor and move assignment to transport it's ownership, or simply use it like type T* or T&.pPoints[0].x cannot compile, use Point(pPoints[0]).x instead. Sorry for that. T is not array type. | using Memory::SafeSharedPtr< T, mutex_t, read_lock_t, write_lock_t >::ArrayHelper< Lock >::element_type = std::remove_extent_t<T> |
Element type of array T.
| using Memory::SafeSharedPtr< T, mutex_t, read_lock_t, write_lock_t >::ArrayHelper< Lock >::pointer = element_type* |
Pointer type of element.
| using Memory::SafeSharedPtr< T, mutex_t, read_lock_t, write_lock_t >::ArrayHelper< Lock >::const_pointer = const element_type* |
Const pointer type of element.
| using Memory::SafeSharedPtr< T, mutex_t, read_lock_t, write_lock_t >::ArrayHelper< Lock >::reference = element_type& |
Reference type of element.
| using Memory::SafeSharedPtr< T, mutex_t, read_lock_t, write_lock_t >::ArrayHelper< Lock >::const_reference = const element_type& |
Const eference type of element.
|
inline |
Constructor a constant ArrayHelper to gain access to element of object managed by SafeSharedPtr.
Will construct Lock object to guard the pointer.
| p | SafeSharedPtr to access from. |
| idx | Index for element in array to access from. |
|
inlinenoexcept |
Move constructor, transport ownership to another ArrayHelper, keep existing lock state.
| other | Another ArrayHelper to move to. |
|
inline |
Destructor, release Lock if exists.
|
inline |
Move assigment, transport ownership to another ArrayHelper, keep existing lock state.
| other | Another ArrayHelper to move to. |
*this with empty content.
|
inline |
Operator overload to act as element_type&.
element_type&.
|
inline |
Operator overload to act as const element_type&.
const element_type&.
|
inline |
Assign operator to assign from another value.
| X | Type of input, X& must be implicitly convertible to element_type&. |
| other | Input value to be assigned from. |
Used for situations like: