From 6ffe0682ab798155129f53b768cb881eac730a1f Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 13 May 2013 22:28:41 -0700 Subject: Add a dumb_ptr template for transition purposes --- src/common/timer.t.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/common/timer.t.hpp') diff --git a/src/common/timer.t.hpp b/src/common/timer.t.hpp index ee9b5d2..1e3a87a 100644 --- a/src/common/timer.t.hpp +++ b/src/common/timer.t.hpp @@ -4,6 +4,8 @@ # include # include +# include "dumb_ptr.hpp" + struct TimerData; /// An implementation of the C++ "clock" concept, exposing @@ -30,13 +32,13 @@ typedef std::function timer_func; class Timer { friend struct TimerData; - TimerData *td; + dumb_ptr td; Timer(const Timer&) = delete; Timer& operator = (const Timer&) = delete; public: /// Don't own anything yet. - Timer() : td(nullptr) {} + Timer() = default; /// Schedule a timer for the given tick. /// If you do not wish to keep track of it, call disconnect(). /// Otherwise, you may cancel() or replace (operator =) it later. @@ -58,7 +60,7 @@ public: void detach(); /// Check if there is a timer connected. - explicit operator bool() { return td; } + explicit operator bool() { return bool(td); } /// Check if there is no connected timer. bool operator !() { return !td; } }; -- cgit v1.2.3-70-g09d2