From 7175b9e435a54cff33914d21384625a445cc5cf0 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 20 Aug 2016 13:34:29 +0100 Subject: test --- src/Globals.h | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'src/Globals.h') diff --git a/src/Globals.h b/src/Globals.h index e3a537eaa..804b0a5ac 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -444,17 +444,49 @@ typename std::enable_if::value, C>::type CeilC(T a_Value) return static_cast(std::ceil(a_Value)); } - - -//temporary replacement for std::make_unique until we get c++14 - namespace cpp14 { + // Temporary replacement for std::make_unique until we get c++14 template std::unique_ptr make_unique(Args&&... args) { return std::unique_ptr(new T(std::forward(args)...)); } + + // Temporary workaround for ... + template + struct move_on_copy_wrapper + { + move_on_copy_wrapper(StorageType && a_Value) : + value(std::move(a_Value)) + { + } + + move_on_copy_wrapper(const move_on_copy_wrapper & a_Other) : + value(std::move(a_Other.value)) + { + } + + move_on_copy_wrapper& operator=(const move_on_copy_wrapper & a_Other) + { + value = std::move(a_Other.value); + return *this; + } + + mutable StorageType value; + }; +} + +namespace std +{ + template + struct equal_to> + { + constexpr bool operator()(const std::weak_ptr & a_Lhs, const std::weak_ptr & a_Rhs) const + { + return (!a_Lhs.owner_before(a_Rhs) && !a_Rhs.owner_before(a_Lhs)); + } + }; } // a tick is 50 ms -- cgit v1.2.3