elshize / irkit

Information Retrieval tools intended for academic research.
https://elshize.github.io/irkit/
MIT License
6 stars 2 forks source link

Fast assert-type fail for expected #62

Closed elshize closed 5 years ago

elshize commented 5 years ago

nonstd::expected is sometimes cumbersome to use. Whenever you require it to has value, certain boilerplate is involved. But why not replace it with a specific type of assert that aborts the program if the variable has unexpected value.

Should work for any printable unexpected type.

Example:

auto result = something_returning_expected().get_value_or_abort();
elshize commented 5 years ago

Implemented as irtl::value() free function.