Click here to Skip to main content
15,925,602 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to set WS_EX_TOPMOST style at runtime? Pin
User 665825-Apr-03 1:02
User 665825-Apr-03 1:02 
GeneralChanging Menu at runtime Pin
JensB24-Apr-03 22:33
JensB24-Apr-03 22:33 
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 
std::vector::push_back() makes a copy of the object you give it - all STL containers do. (It is worth to keep that in mind, because you are responsible to provide working copy-constructors and assignment operators.)

The best way would be the one you did not write:
Function0 (const T& NewElement)
{
  GlobalVector.push_back (NewElement);
}
using a const reference.
A non const reference would be OK here, but if you do not intend to manipulate NewElement, you can as well tell that, and make your Function1 able to cope with constant NewElements.
By-value arguments (Function 2) would result in an additional temporary local copy, which is in turn copied into the vector. Maybe the compiler optimiser would get rid of the unneeded copying, but is wise to rely on that?




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 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 
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 

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.