From 58148e5b158abed9f003e440dcce8cc24f3265d2 Mon Sep 17 00:00:00 2001 From: "Peter D. Barnes, Jr" Date: Fri, 17 Sep 2021 10:58:17 -0700 Subject: [PATCH] doc: Ptr<>::Tester documentation --- src/core/model/ptr.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/model/ptr.h b/src/core/model/ptr.h index fdb75e990..41ef5134d 100644 --- a/src/core/model/ptr.h +++ b/src/core/model/ptr.h @@ -77,7 +77,11 @@ private: /** The pointer. */ T *m_ptr; - /** Helper to test for null pointer. */ + /** + * Helper to test for null pointer. + * + * This supports the "safe-bool" idiom, see `operator Tester * ()` + */ class Tester { public: @@ -196,7 +200,7 @@ public: */ bool operator! (); /** - * Test for non-NULL pointer. + * Test for non-NULL Ptr. * * This enables simple pointer checks like * \code @@ -204,6 +208,8 @@ public: * if (p) ... * \endcode * This also disables deleting a Ptr + * + * This supports the "safe-bool" idiom; see [More C++ Idioms/Safe bool](https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool) */ operator Tester * () const; };