copy-constructor
C++ - call assignment operator at creation instead of copy constructor
I want to enforce explicit conversion between structs kind of like native types: int i1; i1 = some_float; // this generates a warning[详细]
2023-01-16 09:22 分类:问答Default constructor
struct Base{ Base(Base &){}// suppress default constructor }; struct Derived : Base{ }; int main(){ Derived d;[详细]
2023-01-15 18:23 分类:问答Implementing Exception class in C++
So, I am try to write a simple base Exception class for C++, based on the Java Exception class. I\'m sure there are great libraries out there already, but I am doing this for practice, not production[详细]
2023-01-15 07:50 分类:问答Data model, cyclic references
I have the following data structure for storing meridians and parallels. Each cartographic point stores:[详细]
2023-01-15 05:40 分类:问答Why would a copy constructor have more than one parameter?
$12.8/2 - \'A non-template constructor for class X is a copy constructor if its first parameter is of type X&,[详细]
2023-01-15 03:11 分类:问答conversion from 'std::string' to non-scalar type requested
I have trouble implementing my class. It should be able to initialize from std::string. So I wrote a copy (?) constructor:[详细]
2023-01-14 17:39 分类:问答Copy constructor problem
I tried to use copy constructor using statement: X y = X(); But copy constructor is not being called. I am using g++ 4.1.0. I set both X(const X&) and X(x&) constructor in the class.[详细]
2023-01-10 05:30 分类:问答What's all the fuss about C++ copy constructors? [duplicate]
This question already has answers here: Closed 12 years ago. 开发者_如何学Go Possible Duplicate: When do we have to use copy constructors?[详细]
2023-01-09 22:10 分类:问答When do we have to use copy constructors?
I know that C++ compiler creates a copy constructor for a class. In which case do we开发者_Go百科 have to write a user-defined copy constructor? Can you give some examples? The copy constructor genera[详细]
2023-01-08 08:28 分类:问答What is the copy-and-swap idiom?
What is the copy-and-swap idiom and when should it be used? What problems does it solve? Does it change for C++11?[详细]
2023-01-07 16:31 分类:问答