Use operator void * instead of bool in Time classes to avoid obscure problems resulti...
authorMikko Rasa <tdb@tdb.fi>
Sat, 10 Nov 2007 21:45:03 +0000 (21:45 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 10 Nov 2007 21:45:03 +0000 (21:45 +0000)
source/time/timedelta.h
source/time/timestamp.h

index 97c8cac03adf5020fb8e168d11d89c37fb653997..a4595e6680e05ac8185b3e7273ec4acad8cc3136 100644 (file)
@@ -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;
 };
index 44387a216b46711a8f73280f54122b9e72990137..6b264aff6cdadd4ad739e8bb14035bbe8a7798a9 100644 (file)
@@ -51,7 +51,7 @@ public:
        bool      operator<(const TimeStamp &t) const  { return usec<t.usec; }
        bool      operator==(const TimeStamp &t) const { return usec==t.usec; }
        bool      operator!=(const TimeStamp &t) const { return usec!=t.usec; }
-       operator bool() const                          { return usec>0; }
+       operator const void *() const                  { return usec>0 ? this : 0; }
 
        static TimeStamp from_unixtime(time_t t) { return TimeStamp(t*1000000LL); }
 private: