summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius Holeksa <mail@keldu.de>2023-05-23 18:03:06 +0200
committerClaudius Holeksa <mail@keldu.de>2023-05-23 18:03:06 +0200
commitbb1c40e06794e82a4f9aafaeddadd4c634f0a1b3 (patch)
tree3fefd7dd169a8936365d6a4d421e437c00d7d98b
parent613cfebc0b2a2968260e5f9122d7b5e7ba3755c3 (diff)
c++: casting between unit ideas
-rw-r--r--src/kelunit/unit_cast.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/kelunit/unit_cast.h b/src/kelunit/unit_cast.h
new file mode 100644
index 0000000..8dc2689
--- /dev/null
+++ b/src/kelunit/unit_cast.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <forstio/core/common.h>
+
+namespace kel {
+template<typename S, typename From, typename To>
+class unit_convert {
+ static_assert(always_false<S, From, To>, "Units can't be converted to each other");
+};
+
+template<typename Store, typename Same>
+class unit_convert<Store, Same, Same> {
+ static constexpr factor = static_cast<Store>(1);
+};
+}