Hacker News new | ask | show | jobs
by vvanders 3924 days ago
I've been really happy with C++ lambda's lately.

Would be nice to see Rust's Option<T> and Result<T,E> ported over to C++ since I find that error handling extremely elegant compared to most C++ approaches.

2 comments

Already done (kinda). There is no match exhaustion, but C++ is getting an option type. (Part of the library fundamentals TS). http://en.cppreference.com/w/cpp/experimental/optional
Option has been around for a while as boost::optional or now std::experimental::optional. Result is coming and has a reference implementation as boost::expected. There's also a type-erased option type, "any".

They're quite nice, especially with a few trivial additions for ergonomics.

Yup, except you lost me as soon as you said "boost". I enjoy my fast compile speeds very much. :)