Discussion:
About using C++ standard library
(too old to reply)
JiiPee
2015-02-07 00:19:39 UTC
Permalink
I keep thinking about this: for example should I use std::string or
CString in MFC applications? How do you guys do this? When you create
MFC applications do you only use CString (and other MFC containers) or
you use standard library containers (like vector, map, array etc)? MFC
seems to have all of them so which one better to use? Or are you mixing
them so that you use std::string but then pass its character array to
CString when needed to use CString?
David Lowndes
2015-02-07 00:39:18 UTC
Permalink
Post by JiiPee
I keep thinking about this: for example should I use std::string or
CString in MFC applications?
...
I tend now to use CString only where it's interfacing to something MFC
specific - where it's a natural fit.

Almost everywhere else I use std string and containers.

Dave
JiiPee
2015-02-07 01:17:36 UTC
Permalink
Post by David Lowndes
Post by JiiPee
I keep thinking about this: for example should I use std::string or
CString in MFC applications?
...
I tend now to use CString only where it's interfacing to something MFC
specific - where it's a natural fit.
Almost everywhere else I use std string and containers.
Dave
I kind of think the same; have been doing the same. So for example
inside dialog classes I normally only use CString if its simple string
operations.

But if I add complex long code elsewhere which is not related to MFC
directly, then I would like to use C++11 code. I guess MFC is not
following 100% the latest C++11 even?

I wonder why MFC started using their own containers anyway. Why did they
not use std versions? Why cannot CString be just std::string?

And great news is that VC++ and MFC is now for free by Microsoft ! Thats
why am in again :). Was doing wxWidgets for a while, but now back.
David Lowndes
2015-02-07 08:32:12 UTC
Permalink
Post by JiiPee
I wonder why MFC started using their own containers anyway. Why did they
not use std versions?
MFC predates the STL.

Dave
JiiPee
2015-02-07 18:23:07 UTC
Permalink
Post by David Lowndes
Post by JiiPee
I wonder why MFC started using their own containers anyway. Why did they
not use std versions?
MFC predates the STL.
Dave
oh, there is the explanation. But... if I was Microsoft I would have
considered changing them to stl :). At least after 2000 when it was
clear stl is the one people are going to use.

Continue reading on narkive:
Loading...