From 29c471e33a14c2b162ff1a5d681cba85a044524c Mon Sep 17 00:00:00 2001 From: ado Date: Sun, 16 Jul 2023 20:26:09 +0200 Subject: [PATCH] Update valid method for throw_on_error --- include/ss/converter.hpp | 2 ++ include/ss/parser.hpp | 2 ++ include/ss/splitter.hpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/ss/converter.hpp b/include/ss/converter.hpp index b9c7c45..aadc797 100644 --- a/include/ss/converter.hpp +++ b/include/ss/converter.hpp @@ -169,6 +169,8 @@ public: bool valid() const { if constexpr (string_error) { return error_.empty(); + } else if constexpr (throw_on_error) { + return true; } else { return !error_; } diff --git a/include/ss/parser.hpp b/include/ss/parser.hpp index fcb1b5a..d084d94 100644 --- a/include/ss/parser.hpp +++ b/include/ss/parser.hpp @@ -63,6 +63,8 @@ public: bool valid() const { if constexpr (string_error) { return error_.empty(); + } else if constexpr (throw_on_error) { + return true; } else { return !error_; } diff --git a/include/ss/splitter.hpp b/include/ss/splitter.hpp index 87e1ac0..091e3c8 100644 --- a/include/ss/splitter.hpp +++ b/include/ss/splitter.hpp @@ -34,6 +34,8 @@ public: bool valid() const { if constexpr (string_error) { return error_.empty(); + } else if constexpr (throw_on_error) { + return true; } else { return !error_; }