summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authorClaudius 'keldu' Holeksa <mail@keldu.de>2024-09-17 11:21:05 +0200
committerClaudius 'keldu' Holeksa <mail@keldu.de>2024-09-17 11:21:05 +0200
commit1d578450dc82843bd4b24f3a6aad2c1a82bbda5e (patch)
treefdb34a5629308fad6ef9c5e3f0a4290bb688c3c4 /modules/core
parentb23b2276b1ab7977e4cea721322f9d31f6ef85ca (diff)
Managed to get hip to compile
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/c++/common.hpp6
-rw-r--r--modules/core/c++/error.hpp8
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;