src: Add noexcept to move constructor and assignment operator
This commit is contained in:
parent
d49bd50908
commit
3de2654223
|
@ -79,7 +79,7 @@ template <typename T, size_t N> constexpr size_t str_size(T (&)[N]) {
|
||||||
template <typename F, typename... T> struct Defer {
|
template <typename F, typename... T> struct Defer {
|
||||||
Defer(F &&f, T &&... t)
|
Defer(F &&f, T &&... t)
|
||||||
: f(std::bind(std::forward<F>(f), std::forward<T>(t)...)) {}
|
: f(std::bind(std::forward<F>(f), std::forward<T>(t)...)) {}
|
||||||
Defer(Defer &&o) : f(std::move(o.f)) {}
|
Defer(Defer &&o) noexcept : f(std::move(o.f)) {}
|
||||||
~Defer() { f(); }
|
~Defer() { f(); }
|
||||||
|
|
||||||
using ResultType = typename std::result_of<typename std::decay<F>::type(
|
using ResultType = typename std::result_of<typename std::decay<F>::type(
|
||||||
|
@ -104,12 +104,13 @@ template <typename T> struct DList {
|
||||||
DList(const DList &) = delete;
|
DList(const DList &) = delete;
|
||||||
DList &operator=(const DList &) = delete;
|
DList &operator=(const DList &) = delete;
|
||||||
|
|
||||||
DList(DList &&other) : head(other.head), tail(other.tail), len(other.len) {
|
DList(DList &&other) noexcept
|
||||||
|
: head(other.head), tail(other.tail), len(other.len) {
|
||||||
other.head = other.tail = nullptr;
|
other.head = other.tail = nullptr;
|
||||||
other.len = 0;
|
other.len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DList &operator=(DList &&other) {
|
DList &operator=(DList &&other) noexcept {
|
||||||
if (this == &other) {
|
if (this == &other) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue