3 ms·
Both C++ and Rust have nice abstractions. Since you asked for an example of a C++ one, consider a bignum library. In C++ you can write a natural-feeling librar
by millstone 6y ago
Both C++ and Rust have nice abstractions. Since you asked for an example of a C++ one, consider a bignum library.
In C++ you can write a natural-feeling library that provides familiar arithmetic. In Rust, you will be constantly smacked in the face with lifetimes, borrowing, etc. because there's no way to do implicit clones or borrows.
- ChrisSD 6y agoImplicit clones are enabled using the `Copy` marker trait in Rust.
- zozbot234 6y ago`Copy` implies that an object can be bitwise copied while preserving desired semantics; Rust has no exact equivalent to copy construction or move semantics in C++, which can be entirely implicit while involving custom code. (There's a 3rd-party `transfer` crate that enables a `Clone`-like marker for custom moves, however. It's used together with the Pin feature, so these moves are also explicit.)