Skip to content

Commit

Permalink
chore(expected): make move-constructible
Browse files Browse the repository at this point in the history
Signed-off-by: Max SCHMELLER <[email protected]>
  • Loading branch information
mojomex committed Nov 26, 2024
1 parent ee790f0 commit 73228ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nebula_common/include/nebula_common/util/expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#pragma once

#include <exception>
#include <stdexcept>
#include <string>
#include <variant>

Expand Down Expand Up @@ -97,9 +98,10 @@ struct expected
return default_;
}

expected(const T & value) { value_ = value; } // NOLINT(runtime/explicit)

expected(const E & error) { value_ = error; } // NOLINT(runtime/explicit)
expected(const T & value) : value_(value) {} // NOLINT(runtime/explicit)
expected(T && value) : value_(value) {} // NOLINT(runtime/explicit)
expected(const E & error) : value_(error) {} // NOLINT(runtime/explicit)
expected(E && error) : value_(error) {} // NOLINT(runtime/explicit)

private:
std::variant<T, E> value_;
Expand Down

0 comments on commit 73228ef

Please sign in to comment.