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

Proposed by Paul J. Lucas
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11159
Merged at revision: 11341
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 10 lines (+1/-0)
1 file modified
src/store/api/item_handle.h (+1/-0)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+157011@code.launchpad.net

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.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-04-04T03-44-47.432Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/store/api/item_handle.h'
2--- src/store/api/item_handle.h 2013-03-06 10:36:56 +0000
3+++ src/store/api/item_handle.h 2013-04-04 02:55:28 +0000
4@@ -65,6 +65,7 @@
5 }
6
7 bool isNull () const { return p == NULL; }
8+ bool operator!() const { return !p; }
9
10 void setNull() { p = NULL; }
11

Subscribers

People subscribed via source and target branches