util: Add Expected<void, E> specialization

This is not needed, but a bit closer to the std lib, because
std::monostate is no longer leaked through ValueType from the value()
method.
This commit is contained in:
MarcoFalke
2025-12-09 09:10:21 +01:00
parent fa6575d6c2
commit fac4800959
2 changed files with 44 additions and 14 deletions

View File

@@ -66,6 +66,8 @@ BOOST_AUTO_TEST_CASE(expected_error)
{
Expected<void, std::string> e{};
BOOST_CHECK(e.has_value());
[&]() -> void { return e.value(); }(); // check value returns void and does not throw
[&]() -> void { return *e; }();
e = Unexpected{"fail"};
BOOST_CHECK(!e.has_value());