1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-04 03:25:08 +02:00

Add not about C++ copy constructors

This commit is contained in:
Fabian Bornhofen 2023-01-10 13:57:15 +01:00
parent 65837087c9
commit 87b26c78c0

View File

@ -35,6 +35,7 @@ fn main() {
Copying and cloning are not the same thing:
* Copying refers to bitwise copies of memory regions and does not work on arbitrary objects.
* Copying does not allow for custom logic (unlike copy constructors in C++).
* Cloning is a more general operation and also allows for custom behavior by implementing the `Clone` trait.
* Copying does not work on types that implement the `Drop` trait.