utils: Improve option/result types

And add the beginnings of unit tests.
This commit is contained in:
Dirk-Jan C. Binnema
2020-11-26 09:26:28 +02:00
parent 4b6d9a0ce8
commit d0e357c150
5 changed files with 82 additions and 2 deletions

View File

@ -19,8 +19,11 @@
namespace Mu {
/// Either a value of type T, or nothing.
/// Either a value of type T, or None
template <typename T> using Option=tl::optional<T>;
template <typename T> Option<T> Some(T&& t) { return t; }
constexpr auto Nothing = tl::nullopt; // 'None' is take already
}
#endif /*MU_OPTION__*/