Hacker News new | ask | show | jobs
by jcelerier 252 days ago
> I really like how some good structures used by other languages, specially Rust and Zig, have been added to the newer C++ standard. The Result, Optional, and Variant are really sweet for day-to-day use of the language, and those in-process standard libraries of SIMD operations, BLAS mathematical functions, and the the execution library looks really cool, specially as standard.

for Optional and Variant they both were basically standardized versions of boost.optional & boost.variant, which exist since 2003 and 2002 respectively. Most of the time you can just change boost:: to std:: and it works exactly the same ; for many years software I develop could switch from one to another with a simple #ifdef due to platforms not supporting std::optional entirely (older macOS versions, pre 10.14 IIRC)

3 comments

Often the std flavored implementation is inferior of the boost one. Support for optional references has only be added to the draft standard recently, while bossy has had it since forever.
I agree, I was stuck on boost::optional for a long time for this reason, and I only use boost::variant2 for my variant needs, although code can still build with std:: in case a customer really does not want boost
Correct, they have been around for a lot longer than rust.
I knew some changes (like STL containers) came from Boost, but I didn't know those also came from there, and specially since such a long time!

That means I need to look more Boost documentation :)