If copy assignment is ok, then copy ctor can be implemented is terms of copy assignment. Container(const Container& x) { *this = other; } If not... well then it can't be implemented in terms of the other.
When writing the copy ctor for a container (lets say, a dynamic array) should the copy ctor also call the copy ctor of the elements being copied, or should it call copy assignment on each element?
#cplusplus #programming
-
-
Näytä tämä ketjuKiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.