tags:

views:

749

answers:

8
+3  Q: 

MFC and STL

Would you mix MFC with STL? Why?

+11  A: 

Sure. Why not?

I use MFC as the presentation layer, even though the structures and classes in the back-end use STL.

dalle
A: 

Yes I do mix 'em because I find MFC too unwieldy for normal natural looking c++. Though you might have to write some code for conversions where your STL code talks to MFC code.

Raminder
+1  A: 

I mix them all the time. The only minor PITA was serialization - the MFC containers (CArray, CList, CStringArray, etc.) support CArchive serialization, but when using STL containers you have to roll your own code. In the end I switched to using boost::serialization and dumped the MFC CArchive stuff.

Rob
A: 

Yes, I have mixed them before without problems. However, after using MFC for over a decade, I would never consider using it for a new project.

Ferruccio
+1  A: 

For collections in the data layer. I have no data to support this, but my suspicion is that the templated STL collections are more performant than their MFC counterparts.

Aidan Ryan
Yes, the STL containers are faster than MFC collections.
Ron
A: 

Yes, if both of the following conditions hold:

1) The language chosen for the project is C++ (which, of course, includes the STL - the S in the STL is for "Standard").

2) After a careful analysis, no better alternative is found or considered appropriate for the GUI support than MFC, and my development team goes for it.

Daniel Daranas
A: 

It was a very bad idea before Visual Studio 2003's (nearly) full support for the C++ Standard. Now it's not a bad idea at all. Whether it's a good idea depends on the context and what the skillset of your team is.

mwigdahl
+1  A: 

Use STL whenever you can, use MFC when no alternative

Patrick