From f93c076a7b9d59afa4c80ab4241af7fbf252a0ab Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 29 Mar 2008 00:08:56 +0000 Subject: Document SharedPtr bool conversion operator; added test cases for it; also added two test cases for the comparision operators, which currently fail svn-id: r31299 --- common/ptr.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/ptr.h b/common/ptr.h index cad23a18ff..1121ffd665 100644 --- a/common/ptr.h +++ b/common/ptr.h @@ -62,7 +62,7 @@ namespace Common { * The class has implicit upcast support, so if you got a class B derived * from class A, you can assign a pointer to B without any problems to a * SharedPtr object with template parameter A. The very same applies to - * assigment of a SharedPtr object to a SharedPtr object. + * assignment of a SharedPtr object to a SharedPtr object. * * There are also operators != and == to compare two SharedPtr objects * with compatible pointers. @@ -116,6 +116,10 @@ public: */ Pointer get() const { return _pointer; } + /** + * Implicit conversion operator to bool for convenience, to make + * checks like "if (sharePtr) ..." possible. + */ operator bool() const { return _pointer != 0; } /** -- cgit v1.2.3