Home > Back-end >  For C list implementation
For C list implementation

Time:09-27

Move assignment operator in why don't you like mobile constructor, the RHS two Pointers point to the empty

CodePudding user response:

Because if the mobile assignment also like mobile tectonic
First, to get rid of this data, first assignment again,

CodePudding user response:

reference 1/f, the truth is right or wrong response:
because if mobile assignment also like mobile tectonic
First, to get rid of this data, first assignment again,
good so why not take in the mobile assignment RHS of the head and tail are also set to null pointer

CodePudding user response:

Set to null, who give you reclaim memory?

CodePudding user response:

Do you want to clear on the difference between the structure and assignment
For example,
1, the list l=... ; This is tectonic, rather than the assignment, because is tectonic, he should be created from scratch, so don't l clear the head and tail, because at first, he what also have no, so mobile structure can assign the RHS of the head and tail is nullptr;
2, the list l;
.
The list func ();
L=func (); Here is the mobile assignment; L head, tail has a value, so the head and tail of the l with swap and RHS exchange, after the func, the RHS is just a temporary variables automatically recycling, because l head, tail exchange to the RHS, automatically put l original head, tail recycling

CodePudding user response:

references in 4th floor, the truth is more important than right or wrong response:
what do you want to clear on the difference between the structure and assignment
For example,
1, the list l=... ; This is tectonic, rather than the assignment, because is tectonic, he should be created from scratch, so don't l clear the head and tail, because at first, he what also have no, so mobile structure can assign the RHS of the head and tail is nullptr;
2, the list l;
.
The list func ();
L=func (); Here is the mobile assignment; L head, tail has a value, so the head and tail of the l with swap and RHS exchange, after the func, the RHS is just a temporary variables automatically recycling, because l head, tail exchange to the RHS, automatically put l original head, tail recycled
too heart thank you
  • Related