Click here to Skip to main content
15,905,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIs one way better than the other? Pin
RobJones3-Sep-03 7:34
RobJones3-Sep-03 7:34 
AnswerRe: Is one way better than the other? Pin
Maximilien3-Sep-03 8:03
Maximilien3-Sep-03 8:03 
GeneralRe: Is one way better than the other? Pin
dog_spawn3-Sep-03 8:07
dog_spawn3-Sep-03 8:07 
GeneralRe: Is one way better than the other? Pin
RobJones3-Sep-03 8:18
RobJones3-Sep-03 8:18 
GeneralRe: Is one way better than the other? Pin
dog_spawn3-Sep-03 9:37
dog_spawn3-Sep-03 9:37 
GeneralRe: Is one way better than the other? Pin
Alvaro Mendez3-Sep-03 10:46
Alvaro Mendez3-Sep-03 10:46 
GeneralRe: Is one way better than the other? Pin
RobJones3-Sep-03 8:16
RobJones3-Sep-03 8:16 
GeneralRe: Is one way better than the other? Pin
Brad Sokol3-Sep-03 8:33
Brad Sokol3-Sep-03 8:33 
The following two lines are equivalent:

<br />
std::string s1("one");    // Example 1<br />
std::string s2 = "two";   // Example 2<br />


If I recall correctly, there is a standard "short-cut" that compilers can (must?) take to make example 2 above work like example 1. In other words, declaration with assignment is optimised to a constructor provided that an appropriatly overloaded constructor exists. If no constructor, you get a compiler error.

Either would likely be faster then default constructor followed by Format() for two reasons. First, it's two steps. Second, Format() is probably slow with all that string parsing. Of course, YMMV.




Brad
GeneralRe: Is one way better than the other? Pin
Maximilien3-Sep-03 9:07
Maximilien3-Sep-03 9:07 
GeneralRe: Is one way better than the other? Pin
Michael Dunn3-Sep-03 9:20
sitebuilderMichael Dunn3-Sep-03 9:20 
AnswerRe: Is one way better than the other? Pin
Michael Dunn3-Sep-03 9:23
sitebuilderMichael Dunn3-Sep-03 9:23 
AnswerRe: Is one way better than the other? Pin
David Crow3-Sep-03 10:59
David Crow3-Sep-03 10:59 
GeneralCListCtrl custom RectTracker Pin
Nicolas Bonamy3-Sep-03 7:32
Nicolas Bonamy3-Sep-03 7:32 
QuestionHow to prevent of access to the local files through Internet Explorer (WebBrowser ActiveX)? Pin
Valera2411763-Sep-03 5:16
Valera2411763-Sep-03 5:16 
AnswerRe: How to prevent of access to the local files through Internet Explorer (WebBrowser ActiveX)? Pin
Brian Shifrin3-Sep-03 6:53
Brian Shifrin3-Sep-03 6:53 
GeneralAnother transparent question Pin
Zizilamoroso3-Sep-03 5:05
Zizilamoroso3-Sep-03 5:05 
GeneralRe: Another transparent question Pin
Valera2411763-Sep-03 5:34
Valera2411763-Sep-03 5:34 
GeneralRe: Another transparent question Pin
Brian Shifrin3-Sep-03 7:06
Brian Shifrin3-Sep-03 7:06 
GeneralDiable enter key Pin
NewHSKid3-Sep-03 4:45
NewHSKid3-Sep-03 4:45 
GeneralRe: Diable enter key Pin
Ravi Bhavnani3-Sep-03 5:35
professionalRavi Bhavnani3-Sep-03 5:35 
GeneralRe: Diable enter key Pin
NewHSKid3-Sep-03 5:58
NewHSKid3-Sep-03 5:58 
GeneralRe: Diable enter key Pin
Ravi Bhavnani3-Sep-03 6:01
professionalRavi Bhavnani3-Sep-03 6:01 
GeneralRe: Diable enter key Pin
valikac3-Sep-03 6:00
valikac3-Sep-03 6:00 
QuestionHow to capture ENTER key in single line edit box? Pin
melwyn3-Sep-03 4:40
melwyn3-Sep-03 4:40 
AnswerRe: How to capture ENTER key in single line edit box? Pin
Ravi Bhavnani3-Sep-03 5:37
professionalRavi Bhavnani3-Sep-03 5:37 

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.