Home » Community » Coffee corner » How would you design a good copy/move semantics system?
How would you design a good copy/move semantics system? [message #44023] |
Mon, 15 December 2014 15:08 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
This is more of a question for people deeply familiar to the way copy-constructing works.
I was thinking of a system where:
- each class can have a copy and a move optionally
- copy works like the default copy constructor, except for classes where deep copies are needed
- move works pretty much the way it works in U++, but only destroys data that would be copied by a deep copy
- calling move on a class that does not have a move implemented will do a copy
- the rules apply based on class depth
This are the principles. I need to also do an implementation that has as low overhead as possible performance wise and that does not look particularly ugly.
|
|
|
Goto Forum:
Current Time: Wed Apr 24 21:44:17 CEST 2024
Total time taken to generate the page: 0.02693 seconds
|