From: Mikko Rasa Date: Sat, 10 Nov 2007 21:45:03 +0000 (+0000) Subject: Use operator void * instead of bool in Time classes to avoid obscure problems resulti... X-Git-Tag: 1.0~15 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=dff78b5a8a1d947eb3391dd919abfa04a48d589c;p=libs%2Fcore.git Use operator void * instead of bool in Time classes to avoid obscure problems resulting from implicit conversion --- 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: