diff options
Diffstat (limited to 'modules/core/c++')
-rw-r--r-- | modules/core/c++/common.hpp | 6 | ||||
-rw-r--r-- | modules/core/c++/error.hpp | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/modules/core/c++/common.hpp b/modules/core/c++/common.hpp index f63c531..de464b8 100644 --- a/modules/core/c++/common.hpp +++ b/modules/core/c++/common.hpp @@ -90,7 +90,7 @@ public: /** * Main constructor. */ - ref(T& ref__): + constexpr ref(T& ref__): ref_{&ref__} {} @@ -99,14 +99,14 @@ public: /** * Operator retrieving the itself. */ - T& operator()(){ + constexpr T& operator()(){ return *ref_; } /** * Operator retrieving the itself. */ - const T& operator()() const { + constexpr const T& operator()() const { return *ref_; } }; diff --git a/modules/core/c++/error.hpp b/modules/core/c++/error.hpp index dab297e..ac45fbc 100644 --- a/modules/core/c++/error.hpp +++ b/modules/core/c++/error.hpp @@ -18,7 +18,7 @@ namespace saw { * critical and recoverable errors. Additional code ids can be provided to the * constructor if additional distinctions are necessary. */ -class error { +class error final { public: /** * Type alias @@ -101,7 +101,7 @@ namespace impl { /** * Internal registry for all error types. Is generated dynamically. */ -class error_registry { +class error_registry final { private: struct error_info { error_info() = delete; @@ -301,6 +301,10 @@ public: } }; +/** + * This tries to catch cases where error starts including itself as a type which can happen in more complicated cases. + * So this acts as a type safe guard. + */ template <typename T> class error_or<error_or<T>> { private: error_or() = delete; |