#include <referencewrapper.h>
Wraps a pointer, but enforces reference semantics for assignment and hence cannot be null. Can be used just like a normal pointer (e.g. operator -> to call methods). However, even if it works, the use of operator * is discouraged and reference semantics should be used instead. Note that a ReferenceWrapper instance can be converted implicitly to a reference or a pointer of the same type (but not the other way around!). Similar in function to std::reference_wrapper<TYPE>.
Public Member Functions | |
ReferenceWrapper ()=default | |
ReferenceWrapper (const ReferenceWrapper &) noexcept=default | |
ReferenceWrapper & | operator= (const ReferenceWrapper &) noexcept=default |
void | operator= (const TYPE &value) |
UInt | GetHashCode () const |
Bool | IsEqual (const ReferenceWrapper &ref) const |
operator TYPE * () const noexcept | |
operator TYPE & () const noexcept | |
TYPE * | operator-> () const noexcept |
TYPE ** | operator& () noexcept |
Static Public Member Functions | |
static ReferenceWrapper< TYPE > | Create (TYPE &val) noexcept |
static ReferenceWrapper< const TYPE > | CreateConst (TYPE &val) noexcept |
Private Member Functions | |
MAXON_IMPLICIT | ReferenceWrapper (TYPE &ref) noexcept |
MAXON_IMPLICIT | ReferenceWrapper (TYPE &&)=delete |
Private Attributes | |
TYPE * | _ptr |
|
privatenoexcept |
|
privatedelete |
|
default |
|
defaultnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
defaultnoexcept |
void operator= | ( | const TYPE & | value | ) |
Used to change the value of the referenced object.
UInt GetHashCode | ( | ) | const |
Hash function (for maxon::HashMap compatibility).
Bool IsEqual | ( | const ReferenceWrapper< TYPE > & | ref | ) | const |
Comparison function (for maxon::HashMap compatibility).
|
noexcept |
Implicit conversion to a raw pointer type. Makes it possible to pass the object directly to functions like Function(TYPE* t)
.
|
noexcept |
Implicit conversion to reference type. Makes it possible to pass the object directly to functions like Function(TYPE& t)
.
|
noexcept |
Used for calls like referenceWrapper->Function()
.
|
noexcept |
Used for expressions like &referenceWrapper
. Extracts a pointer to the internal pointer.
|
private |