From cb2718ca0bc0ebdc1987dbb8851e4c3686a8ed7a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 14 Feb 2024 22:28:18 +0100 Subject: fix msvc warning --- compat/exception.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 compat/exception.cpp (limited to 'compat/exception.cpp') diff --git a/compat/exception.cpp b/compat/exception.cpp new file mode 100644 index 00000000..f96578d7 --- /dev/null +++ b/compat/exception.cpp @@ -0,0 +1,28 @@ +#include "exception.hpp" + +namespace floormat { + +exception::exception(const exception& other) noexcept +{ + buf.reserve(other.buf.size()); + buf.append(other.buf.begin(), other.buf.end()); +} + +exception::exception(exception&& other) noexcept = default; + +exception& exception::operator=(const exception& other) noexcept +{ + if (&other != this) + { + buf.clear(); + buf.reserve(other.buf.size()); + buf.append(other.buf.begin(), other.buf.end()); + } + return *this; +} + +exception& exception::operator=(floormat::exception&&) noexcept = default; + +const char* exception::what() const noexcept { return buf.data(); } + +} // namespace floormat -- cgit v1.2.3