mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-15 15:16:51 +02:00
Add not about C++ copy constructors
This commit is contained in:
parent
65837087c9
commit
87b26c78c0
@ -35,6 +35,7 @@ fn main() {
|
|||||||
Copying and cloning are not the same thing:
|
Copying and cloning are not the same thing:
|
||||||
|
|
||||||
* Copying refers to bitwise copies of memory regions and does not work on arbitrary objects.
|
* 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.
|
* 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.
|
* Copying does not work on types that implement the `Drop` trait.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user