Skip to content

zeus-cpp/expected

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zeus::expected

Backporting std::expected to C++17.

Features

Implemented C++ Standard Proposals:

  • P0323R12 <expected>
  • P2505R5 Monadic Functions For expected
  • P2549R1 std::unexpected<E> should have error() as member accessor

Implemented LWG Issues:

  • LWG-3836 std::expected<bool, E1> conversion constructor expected(const expected<U, G>&) should take precedence over expected(U&&) with operator bool
  • LWG-3843 std::expected<T,E>::value() & assumes E is copy constructible
  • LWG-3940 std::expected<void, E>::value() also needs E to be copy constructible
  • LWG-4026 Assignment operators of std::expected should propagate triviality
  • LWG-3877 incorrect constraints on const-qualified monadic overloads for std::expected

Enhancements:

  • Enhanced noexcept (covered by tests from MSVC's STL)

Compiler supports

Any compiler that supports C++17 and later should work. Usage against higher language standard is also supported, in which you'll gain some benefits (e.g. better constexpr).

While heavily tested under MSVC and C++20, it's only tested slightly under C++17, since newly-made. May assume that it could just work if it compiled successfully. Feedbacks are welcome.

Table of known compiler status.

Planned Status
MSVC v142 and later Fully tested
GCC 8 and later Slightly tested

Building and testing

Catch2 is required to build the tests. You may choose any preferred package manager to introduce the requirements. Here is the conan one.

# install the requirements
conan install . -s build_type=Debug -b missing
# glance the cmake preset names
cmake --list-presets
cmake --build --list-presets
ctest --list-presets
# configure, build and test per preset names

Acknowledgements

  • tl-expected, the original code base this library came from.
  • MSVC's STL's massive, strong and robust tests.