2 ms·
Your criticisms of C++ are correct. The language is janky to use and filled with edge cases. The standard library is designed by implementers to make most thing
by nyanpasu64 5y ago
Your criticisms of C++ are correct. The language is janky to use and filled with edge cases. The standard library is designed by implementers to make most things possible but few things easy (std::string::contains will be added in C++23 yay!). And using the same-ish iterator interface for vectors and hashmaps results in needlessly unsafe and verbose vector methods (foo.bar[index].insert(foo.bar[index].end(), ...)) and great difficulty implementing hashmap iterators that act like pointers.
Nonetheless the cheat sheets largely do not reflect these issues, but the breadth of functionality C++ supplies. span and string_view are simple and elegant (aside from lifetime errors caught by Rust). Personally I think algorithms try to do too much, and it's not like other languages could cram in binary search, heap algorithms, reduce, scan, permutations... in a "simple, intuitive fashion", though duplicate functionality between iterators and ranges is a problem. Arithmetic conversions and promotions were a mistake (inherited from C) though, and lambda captures and mutability are complex. Reference collapsing has a simple slide but confusing semantics. I'm not sure I see any structured bindings either (these interact poorly with lambda captures lol).