summaryrefslogtreecommitdiffhomepage
path: root/compat/exception.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/exception.cpp')
-rw-r--r--compat/exception.cpp28
1 files changed, 28 insertions, 0 deletions
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