summaryrefslogtreecommitdiffhomepage
path: root/compat/exception.cpp
blob: f96578d7af87351f33a3e49f3dc439f7d78eaa37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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