From 9aafb3e18411ff915595d99476932235705209f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Wed, 12 Jun 2024 13:55:20 +0200 Subject: [PATCH] refactor: Use assert instead of custom throw for invalid argument in TugUtils.hpp --- include/tug/Core/TugUtils.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/tug/Core/TugUtils.hpp b/include/tug/Core/TugUtils.hpp index 1fea096..2a0e9c2 100644 --- a/include/tug/Core/TugUtils.hpp +++ b/include/tug/Core/TugUtils.hpp @@ -1,9 +1,6 @@ -#ifndef TUGUTILS_H_ -#define TUGUTILS_H_ +#pragma once -#include -#include -#include +#include #define throw_invalid_argument(msg) \ throw std::invalid_argument(std::string(__FILE__) + ":" + \ @@ -24,6 +21,8 @@ duration.count(); \ }) +#define tug_assert(expr, msg) assert((expr) && msg) + // calculates arithmetic or harmonic mean of alpha between two cells template constexpr T calcAlphaIntercell(T alpha1, T alpha2, bool useHarmonic = true) { @@ -38,4 +37,3 @@ constexpr T calcAlphaIntercell(T alpha1, T alpha2, bool useHarmonic = true) { return 0.5 * (alpha1 + alpha2); } } -#endif // TUGUTILS_H_