From 357ff7badfc93b3ff82b96375121087df1e23065 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Wed, 17 Jul 2024 12:01:59 +0200 Subject: [PATCH] exception with stringview --- libsrc/core/exception.cpp | 9 +++++++++ libsrc/core/exception.hpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/libsrc/core/exception.cpp b/libsrc/core/exception.cpp index 9ad11ca9..3ed0f0bc 100644 --- a/libsrc/core/exception.cpp +++ b/libsrc/core/exception.cpp @@ -22,6 +22,15 @@ namespace ngcore } + + Exception :: Exception(std::string_view s1, std::string_view s2) + : Exception(std::string(s1)+std::string(s2)) + { } + + Exception :: Exception(std::string_view s1, std::string_view s2, std::string_view s3) + : Exception(std::string(s1)+std::string(s2)+std::string(s3)) + { } + RangeException :: RangeException (// const std::string & where, const char * where, int ind, int imin, int imax) : Exception("") diff --git a/libsrc/core/exception.hpp b/libsrc/core/exception.hpp index c8b281e1..e9ef6c09 100644 --- a/libsrc/core/exception.hpp +++ b/libsrc/core/exception.hpp @@ -32,6 +32,8 @@ namespace ngcore Exception(Exception&&) = default; Exception(const std::string& s); // : m_what(s) {} Exception(const char* s); // : m_what(s) {} + Exception(std::string_view s1, std::string_view s2); + Exception(std::string_view s1, std::string_view s2, std::string_view s3); ~Exception() override = default; Exception& operator =(const Exception&) = default;