aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/utility/Getters.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-07-19 20:02:25 +0200
committer hop311 <hop3114@gmail.com>2024-07-19 20:02:25 +0200
commit03647d2249f72b6545628bb844685f87c4581062 (patch)
tree435dde45bb17dc12e74cc79bd5f25cc7a7ef8dca /src/openvic-simulation/utility/Getters.hpp
parenta673f89bb2705826b1c646365eab1775727372b7 (diff)
Cleanup: inheritance, const movable variables, code formattingformat-cleanup
Diffstat (limited to 'src/openvic-simulation/utility/Getters.hpp')
-rw-r--r--src/openvic-simulation/utility/Getters.hpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/openvic-simulation/utility/Getters.hpp b/src/openvic-simulation/utility/Getters.hpp
index 5d06a8d..c4114eb 100644
--- a/src/openvic-simulation/utility/Getters.hpp
+++ b/src/openvic-simulation/utility/Getters.hpp
@@ -99,14 +99,16 @@ namespace OpenVic::utility {
} \
template<typename T> \
constexpr T* cast_to() { \
- if (is_derived_from<T>() || is_type<CLASS>()) \
+ if (is_derived_from<T>() || is_type<CLASS>()) { \
return (static_cast<T*>(this)); \
+ } \
return nullptr; \
} \
template<typename T> \
- constexpr const T* const cast_to() const { \
- if (is_derived_from<T>() || is_type<CLASS>()) \
- return (static_cast<const T*>(this)); \
+ constexpr T const* const cast_to() const { \
+ if (is_derived_from<T>() || is_type<CLASS>()) { \
+ return (static_cast<T const*>(this)); \
+ } \
return nullptr; \
}
@@ -160,7 +162,7 @@ namespace OpenVic {
* for variable getters created using the PROPERTY macro.
*/
template<typename decl, typename T>
- inline constexpr decltype(auto) _get_property(const T& property) {
+ inline constexpr decltype(auto) _get_property(T const& property) {
if constexpr (std::is_reference_v<decl>) {
/* Return const reference */
return property;