Last active
January 17, 2017 01:38
-
-
Save tomspilman/856521da5affb4fb0e7633633b7a07cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThreadStaticBase | |
{ | |
private: | |
int _tableSize; | |
int* _table; | |
System::Object** _store; | |
protected: | |
ThreadStaticBase(); | |
System::Object** _address(); | |
System::Object* _get(); | |
System::Object* _set(System::Object* value); | |
public: | |
void remove(); | |
}; | |
template< typename T > | |
class ThreadStatic : public ThreadStaticBase | |
{ | |
public: | |
ThreadStatic(T value) { } | |
T operator=(T value) { return (T)_set(value); } | |
operator T() { return (T)_get(); } | |
T* operator &() { return (T*)_address(); } | |
const T operator->() { return (T)_get(); } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment