Would you mix MFC with STL? Why?
Sure. Why not?
I use MFC as the presentation layer, even though the structures and classes in the back-end use STL.
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.
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.
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.
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.
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.
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.