Difference between MFC Container classes and STL libraries

P

Phlip

mailcsprasad said:
When to use STL classes and when to use MFC Container classes?

The decision to use any class over any other one must be made as late as
possible, when you have a real problem to solve. (Tip: Research
"Refactoring", including the "Replace Algorithm Refactor", to keep code
flexible and easy to change.)

However, in this specific case, don't use MFC, hence don't use its container
classes. The best Microsoft-oriented OO library for the Win32 platform is
WTL - Windows Template Library. And use this with STL containers in
preference to nearly anything else.

The reason is STL containers are most widely supported and documented, and
they have a better architecture than MFC. And MFC is all but repudiated;
it's a very poor library that will slow you down.
 
N

n2xssvv g02gfr12930

Phlip said:
mailcsprasad wrote:




The decision to use any class over any other one must be made as late as
possible, when you have a real problem to solve. (Tip: Research
"Refactoring", including the "Replace Algorithm Refactor", to keep code
flexible and easy to change.)

However, in this specific case, don't use MFC, hence don't use its container
classes. The best Microsoft-oriented OO library for the Win32 platform is
WTL - Windows Template Library. And use this with STL containers in
preference to nearly anything else.

The reason is STL containers are most widely supported and documented, and
they have a better architecture than MFC. And MFC is all but repudiated;
it's a very poor library that will slow you down.
I agree, unfortunately I've not seen many jobs advertised where WTL is
used. Unfortunately it would appear most commercial development for
Windows 32 is either using MFC or moved over to NET. Perhaps people are
wary of using WTL, assuming that getting information, support and help,
(try looking at the source), will cause problems.

JB
 
T

Thorsten Kiefer

When to use STL classes and when to use MFC Container classes?

With VC++ I made the experience that you can't export STL containers from a
dll to the application, except for vectors. For example I have a function
in a dll that returns an STL map. Now when I access that map I get an
access violation. Maybe this is a bug of my VC++ version (6.0 or
something).
 
P

Phlip

Thorsten said:
With VC++ I made the experience that you can't export STL containers from
a
dll to the application, except for vectors. For example I have a function
in a dll that returns an STL map. Now when I access that map I get an
access violation. Maybe this is a bug of my VC++ version (6.0 or
something).

Off topic: I suspect VC++ has an issue where 'new' and 'delete' can't use a
pointer that crossed a DLL boundary. I would never use DLLs, only LIBs or
COM objects. Then I would use a SAFEARRAY to transfer arrays.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

MFC c++ 2
STL Container? 4
The perfect STL container 3
Getting some code into container classes 12
Building a Large Container 26
template with STL container 10
MFC and Mac 2
Trying to creade method .between() 3

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top