From 03647d2249f72b6545628bb844685f87c4581062 Mon Sep 17 00:00:00 2001 From: hop311 Date: Fri, 19 Jul 2024 19:02:25 +0100 Subject: Cleanup: inheritance, const movable variables, code formatting --- src/openvic-simulation/utility/Getters.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/openvic-simulation/utility/Getters.hpp') 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 \ constexpr T* cast_to() { \ - if (is_derived_from() || is_type()) \ + if (is_derived_from() || is_type()) { \ return (static_cast(this)); \ + } \ return nullptr; \ } \ template \ - constexpr const T* const cast_to() const { \ - if (is_derived_from() || is_type()) \ - return (static_cast(this)); \ + constexpr T const* const cast_to() const { \ + if (is_derived_from() || is_type()) { \ + return (static_cast(this)); \ + } \ return nullptr; \ } @@ -160,7 +162,7 @@ namespace OpenVic { * for variable getters created using the PROPERTY macro. */ template - inline constexpr decltype(auto) _get_property(const T& property) { + inline constexpr decltype(auto) _get_property(T const& property) { if constexpr (std::is_reference_v) { /* Return const reference */ return property; -- cgit v1.2.3-56-ga3b1