template<typename T>
struct stx::Ok< T >
value-variant for Result<T, E>
wrapping the contained successful value of type T
Note that Ok
is only a value-forwarding type. An Ok<T>
can only be constructed with an r-value. What does this mean?
For example, You can:
Result<vector<int>,
int> a =
Ok(vector{1, 2, 3, 4});
You can't:
vector<int> x {1, 2, 3, 4};
Result<vector<int>,
int> a =
Ok(x);
But, to explicitly make a
take ownership, you will:
vector<int> x {1, 2, 3, 4};
Result<vector<int>,
int> a =
Ok(std::move(x));
Constexpr ?
C++ 17 and above