-
What can C++ do that Rust can’t? (2021 edition)코딩Coding/★Rust★기초★Syntax 2021. 5. 9. 08:19728x90
What can C++ do that Rust can’t? (2021 edition)
*(Mostly based on [this post](https://www.reddit.com/r/rust/comments/5ti9fc/what_can_c_do_that_rust_cant/).)* ***More suggestions and especially...
www.reddit.com
What can C++ do that Rust can’t? (2021 edition)
*(Mostly based on [this post](https://www.reddit.com/r/rust/comments/5ti9fc/what_can_c_do_that_rust_cant/).)*
***More suggestions and especially answers/corrections are welcome. I plan to read the comments and update the list.***
**Legend:**
* **Question**
* ~~Will be solved in the near future~~
* *A feature of debatable usefullness*
**Main:**
* **How advanced is Rust’s `const` compared to `constexpr`? How much of the Standard Library is covered by it? I very much support the modern C++ philosophy of “`constexpr` everything (or as much as the compiler can)”, so I’m interested in how Rust is approaching this.**
* ~~Const generics in Stable~~
* ~~Non-integral const generics~~
* **After we get const generics, will C++ templates have any practical advantages over Rust’s generics, apart from variadics? For example, will it be possible to write a Rust version of [`bounded::integer`](https://github.com/davidstone/bounded-integer)?**
* *Variadic templates + overloading by arity (no need for [some?] macros?)*
* **Does the C++ Stndard Library have anything of use that the Rust one doesn’t?**
* *Function overloading (controversial, but there’s a good [argument](https://www.reddit.com/r/rust/comments/5ti9fc/what_can_c_do_that_rust_cant/dk5li7f/) in favour of it, at least if it’s kept limited enough)*
* **Can you implement a trait for a whole class of types? For example, all integral types? C++ lets you do that with SFINAE, and C++20 makes it easier and prettier with concepts.**
* [Delegation of implementation](https://github.com/rust-lang/rfcs/pull/1406/) (done in C++ with nasty inheritance, but still)
* **Is `index` still as limited as [this comment](https://www.reddit.com/r/rust/comments/5ti9fc/what_can_c_do_that_rust_cant/ddmzqng/) says? And how much of a problem is it? I don’t have enough experience with Rust to tell myself.**
* *Automatic initialization of objects by field order*
* *Internal vtables (an optimization for a common case; if you know the set of functions up-front, you can deal with that more efficiently)*
* **How small can Rust executables get with dynamic linking compared to equivalent C++ executables? Does Rust have a stdlib package that you can simply add as a dependency to your dynamically linked programs (just as C++ binaries depend on its own Standard Library shared objects being present in the system), or does it require some black magic? Will non-stable ABI create problems?**
* `decltype`
* Memory model
* Language specification
* More existing library support
* **Note to self: look over modern C++ features, see if there’s anything useful Rust hasn’t had for ages.**반응형'코딩Coding > ★Rust★기초★Syntax' 카테고리의 다른 글
Rust) How to get the Path of stdout? (0) 2021.05.12 C++ can do all that rust does? (0) 2021.05.12 Rust) From<T> for Vec<T> (0) 2021.05.12 RUST)러스트 개발자들이 다른 개발자들을 위한 오픈 소스 러스트 프로젝트들을 등록하는 곳 (0) 2021.05.09 Introduction - The Rust Reference러스트 영문 설명서 (0) 2021.05.08 Rust Keywords(영문),예약어(Reserved Word) (0) 2021.05.08 Rust 명령어 rustup, rustc, cargo run 연습 (0) 2021.05.07 Rust 초보자를 위한 설명서-Learn(마이크로소프트) (0) 2021.05.07