← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Added:

    bool ItemHandle::operator!() const;

so you can write code like:

    if ( !h )

rather than the annoying:

    if ( !h.getp() )

Note that is a hack fix.  The correct way to do this is by adding conversion-to-bool.  However, adding that causes ambiguities because whoever wrote ItemHandle added implicit conversion to T* which is wrong.  Removing implicit conversion to T*, however, breaks too much code; hence the hack fix.

Requested reviews:
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #1031951 in Zorba: "json-parse segfault"
  https://bugs.launchpad.net/zorba/+bug/1031951

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/157011

Added:

    bool ItemHandle::operator!() const;

so you can write code like:

    if ( !h )

rather than the annoying:

    if ( !h.getp() )

Note that is a hack fix.  The correct way to do this is by adding conversion-to-bool.  However, adding that causes ambiguities because whoever wrote ItemHandle added implicit conversion to T* which is wrong.  Removing implicit conversion to T*, however, breaks too much code; hence the hack fix.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/157011
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/api/item_handle.h'
--- src/store/api/item_handle.h	2013-03-06 10:36:56 +0000
+++ src/store/api/item_handle.h	2013-04-04 02:55:28 +0000
@@ -65,6 +65,7 @@
   }
 
   bool isNull () const { return p == NULL; }
+  bool operator!() const { return !p; }
 
   void setNull() { p = NULL; }
 


Follow ups