copy-constructor
Calling copy constructor of base class while creating object of derive class by copying another object of derive class
class base {}; class der : public base{}; der d1; der d2(d1); This statement invokes default constructor of class base then copy constructor of claas der.[详细]
2023-04-02 05:34 分类:问答C++: When is a class implicitly copied?
When is a class implicitly copied in C++? I have a class that contains a unique_ptr, and therefore cannot be safely copied, and therefore, I disabled the copy constructor on the class by creating pr[详细]
2023-04-01 22:23 分类:问答Calling push_back on a std::vector of objects (not pointers) has serious side effects. So would pointers be better?
This follows on from my previous question, where I was slow to supply all the information so I am creating a new question in the hope of more input. Given:[详细]
2023-03-31 10:38 分类:问答copy-constructor related question (native c++) [duplicate]
This question already has answers here: 开发者_JAVA技巧 Closed 11 years ago. Possible Duplicate: Why should the copy constructor accept its parameter by reference in C++?[详细]
2023-03-31 06:04 分类:问答Questions about a Segmentation Fault in C++ most likely caused by a custom copy constructor
I\'m getting a segmentation fault which I believe is caused by the copy constructor. However, I can\'t find an example like this one anywhere online. I\'ve read about shallow copy and deep copy but I\[详细]
2023-03-30 23:37 分类:问答"deleting" copy ctor/assignment in C++11
In VS 2010 SP1, the following: class Foo { public: Foo() { } Foo(Foo const&) = delete; // Line 365 Foo& operator=(Foo const&) = delete; // Line 366[详细]
2023-03-28 23:45 分类:问答Problem with ostringstream and copy constructor [duplicate]
This question already has answers here: 开发者_JAVA技巧 Closed 11 years ago. Possible Duplicates: Why copying stringstream is not allowed?[详细]
2023-03-28 01:57 分类:问答How to implement safe copy constructor for class that has internal placement new (with std::string)
Here\'s my code: struct RS_Token { char id; char cleanup; unsigned char array[sizeof (std::string) > sizeof (double) ? sizeof (std::string) : sizeof (double)];[详细]
2023-03-27 10:36 分类:问答Is it possible to "add" to the default copy constructor?
Is it possible to \"add\" to the default copy constructor? Eg. For this class: class A { public: int a; int* b;[详细]
2023-03-24 23:41 分类:问答What's the use of the private copy constructor in c++
Why do people define a private copy constructor? When is making the copy constructor and the assignment operator private a good design?[详细]
2023-03-23 02:36 分类:问答