copy-constructor
Is there a way to check if its safe to copy or assign an object in C++?
I have the following problem. I\'m using the C library igraph (http://igraph.sourceforge.net/) in a program I must do in c++. So I found a c++ wrapper of this C library (http://code.google.com/p/igrap[详细]
2023-01-27 06:57 分类:问答Vector of pointer to objects, need deep copy of vector, but the objects are the base of inherited objects
I want to have a deep copy of an vector with pointers to objects, but the object can either be C or B. I know confusi开发者_运维知识库ng (the way I explain it), let me illustrate.[详细]
2023-01-26 12:52 分类:问答Proper way to deep copy with copy constructor instead of Object.clone
I have some code that performs a deep copy using Object.clone, but I\'m trying to rewrite it using the more \"acceptable\" copy constructor technique. Below are two simple examples of what I\'m trying[详细]
2023-01-25 16:36 分类:问答What is The Rule of Three?
What does 开发者_开发知识库copying an object mean? What are the copy constructor and the copy assignment operator?[详细]
2023-01-25 03:09 分类:问答How are C++ array members handled in copy control functions?
This is something I have wondered for a long time. Take the following example: struct matrix { float data[16];[详细]
2023-01-24 13:47 分类:问答Problem with const qualifiers to get private atributes of an object
I\'m a completely new to C开发者_StackOverflow中文版++ and I\'m having a very stupid problem. I have a Graph class and I need to create a copy constructor for it. This is my class:[详细]
2023-01-21 12:05 分类:问答In an STL Map of structs, why does the "[ ]" operator cause the struct's dtor to be invoked 2 extra times?
I\'ve created a simple test case exhibiting a strange behavior I\'ve noticed in a larger code base I\'m working on. This test case is below. I\'m relying on the STL Map\'s \"[ ]\" operator to create a[详细]
2023-01-21 03:32 分类:问答Bad memory allocation C++ for a vector
I get std_bad_alloc error in the following code. It seems the problems is when I add the matrix to the vect开发者_运维技巧or, the program crashes when I get to that line in the debugger. The problem i[详细]
2023-01-20 05:09 分类:问答C++ unrestricted union workaround
#include <stdio.h> struct B { int x,y; }; struct A : public B { // This whines about \"copy assignment operator not allowed in union\"[详细]
2023-01-18 23:06 分类:问答C++ virtual inheritace and typecasting/copy constructor confusion
I have the code below: class A { }; class B: public virtual A { public: B() { cerr << \"B()\"; } 开发者_开发技巧B(const A& a)[详细]
2023-01-17 12:38 分类:问答