Pointer to a thread-local variable. More...
#include <SFML/System/ThreadLocalPtr.hpp>
Public Member Functions | |
ThreadLocalPtr (T *value=NULL) | |
Default constructor. | |
T & | operator* () const |
Overload of unary operator *. | |
T * | operator-> () const |
Overload of operator -> | |
operator T* () const | |
Conversion operator to implicitly convert the pointer to its raw pointer type (T*) | |
ThreadLocalPtr< T > & | operator= (T *value) |
Assignment operator for a raw pointer parameter. | |
ThreadLocalPtr< T > & | operator= (const ThreadLocalPtr< T > &right) |
Assignment operator for a ThreadLocalPtr parameter. | |
Pointer to a thread-local variable.
sf::ThreadLocalPtr is a type-safe wrapper for storing pointers to thread-local variables.
A thread-local variable holds a different value for each different thread, unlike normal variables that are shared.
Its usage is completely transparent, so that it is similar to manipulating the raw pointer directly (like any smart pointer).
Usage example:
ThreadLocalPtr is designed for internal use; however you can use it if you feel like it fits well your implementation.
Definition at line 41 of file ThreadLocalPtr.hpp.
sf::ThreadLocalPtr< T >::ThreadLocalPtr | ( | T * | value = NULL | ) |
Default constructor.
value | Optional value to initialize the variable |
sf::ThreadLocalPtr< T >::operator T* | ( | ) | const |
Conversion operator to implicitly convert the pointer to its raw pointer type (T*)
T & sf::ThreadLocalPtr< T >::operator* | ( | ) | const |
Overload of unary operator *.
Like raw pointers, applying the * operator returns a reference to the pointed-to object.
T * sf::ThreadLocalPtr< T >::operator-> | ( | ) | const |
Overload of operator ->
Similarly to raw pointers, applying the -> operator returns the pointed-to object.
ThreadLocalPtr< T > & sf::ThreadLocalPtr< T >::operator= | ( | const ThreadLocalPtr< T > & | right | ) |
Assignment operator for a ThreadLocalPtr parameter.
right | ThreadLocalPtr to assign |
ThreadLocalPtr< T > & sf::ThreadLocalPtr< T >::operator= | ( | T * | value | ) |
Assignment operator for a raw pointer parameter.
value | Pointer to assign |