Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
nonstd/expected.hpp
✓ #include <nonstd/expected.hpp>
Use expected to handle division by zero without exceptions.
#include <nonstd/expected.hpp>
#include <iostream>
nonstd::expected<int, std::string> divide(int a, int b) {
if (b == 0) return nonstd::make_unexpected("division by zero");
return a / b;
}
int main() {
auto result = divide(10, 2);
if (result) std::cout << *result << std::endl;
else std::cout << result.error() << std::endl;
return 0;
}
Debug
Known issues
No known issues recorded.
Audit
Dependencies
No dependency data recorded yet.
Resources
No resource links recorded.