From 44509498b703fa39668e42371e19f3f4ad7a5e82 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 28 Jan 2020 14:13:12 +1100 Subject: [PATCH] singleton: add a public query for validity --- singleton.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/singleton.hpp b/singleton.hpp index a8b0361d..099651b2 100644 --- a/singleton.hpp +++ b/singleton.hpp @@ -27,6 +27,13 @@ namespace cruft { static SelfT *instance; public: + static bool + valid (void) noexcept + { + return instance; + } + + /// instantiates the one blessed value of this type. /// /// `instantiate` must be called once and once only before any calls