1818#include < type_traits>
1919#include < utility>
2020
21- /* **********************************/ REACT_BEGIN /* ***********************************/
22-
23- // //////////////////////////////////////////////////////////////////////////////////////
24- // / ThreadLocalPtr
25- // //////////////////////////////////////////////////////////////////////////////////////
26- template <typename T>
27- class ThreadLocalStaticPtr
28- {
29- public:
30- static T* Get () { return ptr_; }
31- static void Set (T* ptr) { ptr_ = ptr; }
32- static void Reset () { ptr_ = nullptr ; }
33- static bool IsNull () { return ptr_ == nullptr ; }
34-
35- private:
36- ThreadLocalStaticPtr () {}
37-
38- static __declspec (thread) T* ptr_;
39- };
40-
41- template <typename T>
42- T* ThreadLocalStaticPtr<T>::ptr_(nullptr );
21+ /* ********************************/ REACT_IMPL_BEGIN /* ********************************/
4322
4423// //////////////////////////////////////////////////////////////////////////////////////
4524// / Unpack tuple - see
@@ -83,45 +62,11 @@ inline auto apply(F && f, T && t)
8362template <typename ... TArgs>
8463inline void pass (TArgs&& ...) {}
8564
86- // Expand args by wrapping them in a dummy function
87- // Use comma operator to replace potential void return value with 0
88- #define REACT_EXPAND_PACK (...) pass((__VA_ARGS__ , 0 ) ...)
89-
9065// //////////////////////////////////////////////////////////////////////////////////////
9166// / Format print bits
9267// //////////////////////////////////////////////////////////////////////////////////////
9368void PrintBits (size_t const size, void const * const p);
9469
95- // //////////////////////////////////////////////////////////////////////////////////////
96- // Get current date/time
97- // //////////////////////////////////////////////////////////////////////////////////////
98- const std::string CurrentDateTime ();
99-
100- // //////////////////////////////////////////////////////////////////////////////////////
101- // Get unique random numbers from range.
102- // //////////////////////////////////////////////////////////////////////////////////////
103- template <typename T, typename TGen>
104- const std::vector<T> GetUniqueRandomNumbers (TGen gen, T from, T to, int count)
105- {
106- std::vector<T> data (1 + to - from);
107- int c = from;
108- for (auto & p : data)
109- p = c++;
110-
111- for (int i=0 ; i<count; i++)
112- {
113- std::uniform_int_distribution<T> dist (i,(to - from));
114- auto r = dist (gen);
115-
116- if (r != i)
117- std::swap (data[i], data[r]);
118- }
119- data.resize (count);
120- std::sort (data.begin (), data.end ());
121-
122- return std::move (data);
123- }
124-
12570// //////////////////////////////////////////////////////////////////////////////////////
12671// Identity (workaround to enable enable decltype()::X)
12772// //////////////////////////////////////////////////////////////////////////////////////
@@ -131,4 +76,8 @@ struct Identity
13176 using Type = T;
13277};
13378
134- /* ***********************************/ REACT_END /* ************************************/
79+ /* *********************************/ REACT_IMPL_END /* *********************************/
80+
81+ // Expand args by wrapping them in a dummy function
82+ // Use comma operator to replace potential void return value with 0
83+ #define REACT_EXPAND_PACK (...) REACT_IMPL::pass((__VA_ARGS__ , 0 ) ...)
0 commit comments