expected: add constref value constructor
This commit is contained in:
parent
df4e75d2ac
commit
b86a9bbdfb
15
expected.hpp
15
expected.hpp
@ -11,6 +11,7 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
namespace cruft {
|
namespace cruft {
|
||||||
class bad_expected_access : public std::exception {
|
class bad_expected_access : public std::exception {
|
||||||
@ -45,10 +46,16 @@ namespace cruft {
|
|||||||
using error_type = ErrorT;
|
using error_type = ErrorT;
|
||||||
|
|
||||||
expected () = delete;
|
expected () = delete;
|
||||||
expected (expected &&) = default;
|
expected (expected &&);
|
||||||
expected& operator=(expected &&) = default;
|
expected& operator=(expected &&);
|
||||||
expected (expected const&) = default;
|
expected (expected const&);
|
||||||
expected& operator=(expected const&) = default;
|
expected& operator=(expected const&);
|
||||||
|
|
||||||
|
expected (ValueT const &_value)
|
||||||
|
{
|
||||||
|
::new (&m_store.value) ValueT (_value);
|
||||||
|
m_valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
expected (ValueT &&_value)
|
expected (ValueT &&_value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user