diff options
Diffstat (limited to 'qpid/cpp/src/qpid/client/Handle.h')
-rw-r--r-- | qpid/cpp/src/qpid/client/Handle.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/client/Handle.h b/qpid/cpp/src/qpid/client/Handle.h index d8b822d0f9..12fb4cf3c1 100644 --- a/qpid/cpp/src/qpid/client/Handle.h +++ b/qpid/cpp/src/qpid/client/Handle.h @@ -30,9 +30,11 @@ namespace client { template <class T> class HandlePrivate; /** - * A handle is like a pointer: it points to some underlying object. + * A handle is like a pointer: it points to some implementation object. + * Copying the handle does not copy the object. + * * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the - * implicit conversion to bool to test for a null handle. + * conversion to bool to test for a null handle. */ template <class T> class Handle { public: @@ -46,8 +48,11 @@ template <class T> class Handle { /**@return true if handle is null. It is an error to call any function on a null handle. */ QPID_CLIENT_EXTERN bool isNull() const { return !impl; } + /** Conversion to bool supports idiom if (handle) { handle->... } */ QPID_CLIENT_EXTERN operator bool() const { return impl; } - QPID_CLIENT_EXTERN bool operator !() const { return impl; } + + /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ + QPID_CLIENT_EXTERN bool operator !() const { return !impl; } QPID_CLIENT_EXTERN void swap(Handle<T>&); |