Click here to Skip to main content
16,005,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralLong Template Declarations Pin
Makover24-Apr-03 21:49
Makover24-Apr-03 21:49 
GeneralRe: Long Template Declarations Pin
Joaquín M López Muñoz25-Apr-03 3:20
Joaquín M López Muñoz25-Apr-03 3:20 
GeneralRe: Long Template Declarations Pin
Makover25-Apr-03 4:20
Makover25-Apr-03 4:20 
GeneralRe: Long Template Declarations Pin
Joaquín M López Muñoz25-Apr-03 4:38
Joaquín M López Muñoz25-Apr-03 4:38 
QuestionHow to use vector.push_back correctly and efficiently? Pin
George224-Apr-03 19:04
George224-Apr-03 19:04 
AnswerRe: How to use vector.push_back correctly and efficiently? Pin
jhwurmbach24-Apr-03 20:28
jhwurmbach24-Apr-03 20:28 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
George224-Apr-03 20:55
George224-Apr-03 20:55 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
jhwurmbach24-Apr-03 21:25
jhwurmbach24-Apr-03 21:25 
George2 wrote:
From your reply, I think I must supply my class
a copy constructor if I want to push it in STL
container.


If you do not, the compiler will automagically do that for you.
But what the compiler provides is very basic: It copies each element of your object.
Bitwise copying with basic types (int, double etc.) and calling the copy constructor with objects.

That may well be exactly what you want - then there is no need to write one yourself.

But if you need complicated stuff you need to write that yourself. And while you are at it, you also need to make an assignment operator, doing the same.


George2 wrote:
Since copy constructor has many form

No. it has exactly one form:
NewElement(const NewElement& rhs);

The ones I write are mostly very small, because I only call the assignment operator in them:
NewElement::NewElement(const NewElement& rhs)
{
  *this = rhs;
}
My assignment operator then does all the copying. So the two are always consistent.



My opinions may have changed, but not the fact that I am right.
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
George224-Apr-03 22:02
George224-Apr-03 22:02 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
jhwurmbach24-Apr-03 22:05
jhwurmbach24-Apr-03 22:05 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
George224-Apr-03 22:13
George224-Apr-03 22:13 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
jhwurmbach24-Apr-03 22:20
jhwurmbach24-Apr-03 22:20 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
George224-Apr-03 22:36
George224-Apr-03 22:36 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
Joaquín M López Muñoz25-Apr-03 3:16
Joaquín M López Muñoz25-Apr-03 3:16 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
George225-Apr-03 3:33
George225-Apr-03 3:33 
GeneralRe: How to use vector.push_back correctly and efficiently? Pin
jhwurmbach25-Apr-03 4:53
jhwurmbach25-Apr-03 4:53 
GeneralWin API and classwizard Pin
73Zeppelin24-Apr-03 17:57
73Zeppelin24-Apr-03 17:57 
QuestionHow to make a CPropertySheet's help button invisible? Pin
fat88824-Apr-03 16:51
fat88824-Apr-03 16:51 
AnswerRe: How to make a CPropertySheet's help button invisible? Pin
Joan M24-Apr-03 21:52
professionalJoan M24-Apr-03 21:52 
AnswerRe: How to make a CPropertySheet's help button invisible? Pin
David Crow25-Apr-03 2:56
David Crow25-Apr-03 2:56 
GeneralDLL help Pin
psksvp24-Apr-03 16:19
psksvp24-Apr-03 16:19 
GeneralRe: DLL help Pin
John R. Shaw24-Apr-03 17:12
John R. Shaw24-Apr-03 17:12 
GeneralRe: DLL help Pin
Antti Keskinen25-Apr-03 6:39
Antti Keskinen25-Apr-03 6:39 
GeneralEdit Control Pin
Anthony988724-Apr-03 15:57
Anthony988724-Apr-03 15:57 
GeneralRe: Edit Control Pin
John R. Shaw24-Apr-03 17:39
John R. Shaw24-Apr-03 17:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.