From dff78b5a8a1d947eb3391dd919abfa04a48d589c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 10 Nov 2007 21:45:03 +0000 Subject: [PATCH] Use operator void * instead of bool in Time classes to avoid obscure problems resulting from implicit conversion --- source/time/timedelta.h | 2 +- source/time/timestamp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/time/timedelta.h b/source/time/timedelta.h index 97c8cac..a4595e6 100644 --- a/source/time/timedelta.h +++ b/source/time/timedelta.h @@ -70,7 +70,7 @@ public: bool operator==(const TimeDelta &t) const { return usec==t.usec; } bool operator!=(const TimeDelta &t) const { return usec!=t.usec; } - operator bool() const { return usec; } + operator const void *() const { return usec ? this : 0; } private: RawTime usec; }; diff --git a/source/time/timestamp.h b/source/time/timestamp.h index 44387a2..6b264af 100644 --- a/source/time/timestamp.h +++ b/source/time/timestamp.h @@ -51,7 +51,7 @@ public: bool operator<(const TimeStamp &t) const { return usec0; } + operator const void *() const { return usec>0 ? this : 0; } static TimeStamp from_unixtime(time_t t) { return TimeStamp(t*1000000LL); } private: -- 2.45.2