diff options
author | BrickPi <49528459+BrickPi@users.noreply.github.com> | 2023-10-25 12:16:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 12:16:05 +0200 |
commit | fd1b24dfc6988eaa301645f0f5f2fcd845eb0a29 (patch) | |
tree | bd5fba638a55c683e587eb5e2bbde43ab5fb1a00 /src/openvic-simulation/dataloader/NodeTools.hpp | |
parent | 7bda541557722b2a244e80796c612b735d8b5cf7 (diff) | |
parent | c9c198e3b47e84eaea998cd9d2f7a8aa2b50ce73 (diff) |
Merge pull request #60 from OpenVicProject/country-history-loading
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp')
-rw-r--r-- | src/openvic-simulation/dataloader/NodeTools.hpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp index 66b614a..6469100 100644 --- a/src/openvic-simulation/dataloader/NodeTools.hpp +++ b/src/openvic-simulation/dataloader/NodeTools.hpp @@ -26,17 +26,17 @@ namespace OpenVic { namespace NodeTools { - template<typename Fn, typename Return = void, typename ...Args> - concept Functor = requires(Fn&& fn, Args&& ...args) { + template<typename Fn, typename Return = void, typename... Args> + concept Functor = requires(Fn&& fn, Args&&... args) { { std::invoke(std::forward<Fn>(fn), std::forward<Args>(args)...) } -> std::same_as<Return>; }; - template<typename Fn, typename Return = void, typename ...Args> - concept FunctorConvertible = requires(Fn&& fn, Args&& ...args) { + template<typename Fn, typename Return = void, typename... Args> + concept FunctorConvertible = requires(Fn&& fn, Args&&... args) { { std::invoke(std::forward<Fn>(fn), std::forward<Args>(args)...) } -> std::convertible_to<Return>; }; - template<typename Fn, typename ...Args> + template<typename Fn, typename... Args> concept Callback = Functor<Fn, bool, Args...>; template<typename Fn> @@ -78,9 +78,7 @@ namespace OpenVic { val <= static_cast<int64_t>(std::numeric_limits<T>::max())) { return callback(val); } - Logger::error("Invalid int: ", val, " (valid range: [", - static_cast<int64_t>(std::numeric_limits<T>::lowest()), ", ", - static_cast<int64_t>(std::numeric_limits<T>::max()), "])"); + Logger::error("Invalid int: ", val, " (valid range: [", static_cast<int64_t>(std::numeric_limits<T>::lowest()), ", ", static_cast<int64_t>(std::numeric_limits<T>::max()), "])"); return false; }); } @@ -91,8 +89,7 @@ namespace OpenVic { if (val <= static_cast<uint64_t>(std::numeric_limits<T>::max())) { return callback(val); } - Logger::error("Invalid uint: ", val, " (valid range: [0, ", - static_cast<uint64_t>(std::numeric_limits<T>::max()), "])"); + Logger::error("Invalid uint: ", val, " (valid range: [0, ", static_cast<uint64_t>(std::numeric_limits<T>::max()), "])"); return false; }); } |