aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/utility/Getters.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-07-19 21:35:31 +0200
committer GitHub <noreply@github.com>2024-07-19 21:35:31 +0200
commitd1f3a96b72dd06b5f97dd4643e5f016a02b42ea6 (patch)
tree38015e5729afbb98cf520e2cf26d8a4623d32f2f /src/openvic-simulation/utility/Getters.hpp
parente0518bee9b4c164f40716a8033b5e207c2060c0b (diff)
parent03647d2249f72b6545628bb844685f87c4581062 (diff)
Merge pull request #176 from OpenVicProject/format-cleanup
Cleanup: inheritance, const movable variables, code formatting
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;