Your first solution conveys to the reader that the copy-constructor is private and is not to be used.
你的第一个解决方案向读者传达,拷贝构造函数是私有的,不能使用。
The traditional way to solve this is to declare the copy-constructor private and to leave it unimplemented.
传统的方式来解决这个是声明拷贝构造函数私有和未实现的。
You know that Set has a copy constructor.
您知道Set有一个拷贝构造函数。
If you do not write a correct code for the copy constructor, object within a list will have some data members uninitialized.
如果你没有为拷贝构造函数写正确的代码,就有可能造成list中对象的某些数据成员没有初始化。
Also, for classes that have design reasons to have private or no copy constructor, this style of swapping won't work. Here's what boost: : swap gets you.
另外,对于出于设计原因拥有private构造函数而没有复制构造函数的类,所以这种交换风格不适用。
Modeling constructor, destructor, and copy constructor.
建模构造函数、分析构造函数,以及拷贝构造函数。
Listing 2 shows a piece of code that results in a compile-time error because the copy constructor is private.
清单2显示了产生编译时错误的代码部分,因为该拷贝构造函数是私有的。
You should create a copy constructor for each object yourself.
你应该创建一个拷贝构造函数的每个对象自己。
For a situation where an object contain Pointers we have to write our own copy constructor that will prevent situations like those mentioned above.
对于类对象包含指针的情况下,我们要编写自己的拷贝构造函数,这样可以防止上述情况的发生。
Why am I not provided with a default copy constructor from a volatile?
我为什么不具有挥发性的默认的复制构造函数?
The copy constructor is a special kind of constructor which creates a new object which is a copy of an existing one, and does it efficiently.
拷贝构造函数是一种特别的构造函数,用于复制已经存在的对象到新生成的对象,这是一种高效的方式。
You do not need a copy constructor, and you need never sweat the gory details of implementing a clone method.
您不需要使用复制构造函数,并且永远也不需要大汗淋漓地去实现clone方法的那些令人惨不忍睹的细节。
The noncopyable class definition presents no surprises, as the copy constructor and operator= are declared private.
noncopyable类定义没有什么令人感到新奇的地方,因为copy constructor和operator= 声明为 private。
The only other thing to note in Listing 17 is that the definitions for the copy constructor and operator= methods are not provided.
清单17中要注意的另一点是,未提供copy constructor和operator=方法的定义。
In the first case, you are essentially declaring a private copy constructor and then not providing any implementation. By declaring them private, non-members cannot copy it.
在第一种情况下,你基本上是声明一个私有拷贝构造函数,然后没有提供任何实现。通过声明他们私人,非成员国不能复制它。
Is this a valid copy constructor?
这是一个有效的拷贝构造函数吗?
How to call to the copy constructor from the copy-assignment operator?
如何从复制赋值运算符调用复制构造函数?
Each class whose instance will go into the container must implement at least the copy constructor it is good to implement also the assignment operator.
每个类(其实例要在容器内使用)必须至少实现拷贝构造函数(实现赋值运算符,也是好习惯)。
How to write a copy constructor?
如何写一个复制构造函数?
Put the functionality you need in separate functions called by the destructor and the copy constructor and the assignment operator.
放在单独的功能调用析构函数和拷贝构造函数和赋值运算符你所需要的功能。
Why does this code invoke the copy constructor?
为什么这段代码调用复制构造函数?
Why copy constructor is not called here?
为什么复制构造函数不叫吗?
Is this implicitly calling a copy constructor?
这是隐式调用复制构造函数?
Default copy constructor does a very simple operation, they will do a bit-wise (member-wise) copy of an object, which means that the object will be copied bit by bit.
如果程序员没有提供拷贝构造函数,那么编译器会自动生成默认的拷贝构造函数。默认的拷贝构造函数会执行简单的操作,即按位拷贝对象。
Why ampersand is used in copy constructor?
为什么连字号用于复制构造函数?
Because a template constructor is never a copy constructor, the presence of such a template does not suppress the implicit declaration of a copy constructor.
由于模板构造函数终究不是拷贝构造函数,因此这种模板的出现并不会隐藏原来隐含的拷贝构造函数之声明。
When I return by value from an assignment operator, firstly what is the mechanism and basis of calling the copy constructor?
当我返回值赋值操作符,首先是调用复制构造函数为基础的机制?
The assignment operator is applied on a initialized object, but this is not the case in the copy constructor.
赋值运算符是应用于一个初始化的对象,但这并不是拷贝构造函数的情况下。
How else could you use that return instruction to create and return an object and yet not use the copy constructor?
不然你怎么使用返回指令创建并返回一个对象而不使用复制构造函数?
How else could you use that return instruction to create and return an object and yet not use the copy constructor?
不然你怎么使用返回指令创建并返回一个对象而不使用复制构造函数?
应用推荐