473,396 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Difference between MFC Container classes and STL libraries

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

Aug 2 '06 #1
4 3117
mailcsprasad wrote:
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.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 2 '06 #2
Phlip wrote:
mailcsprasad wrote:

>>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.
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
Aug 2 '06 #3
ma**********@gmail.com wrote:
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).

Aug 2 '06 #4
Thorsten Kiefer wrote:
>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).
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.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 2 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Edward Diener | last post by:
In the tutorial on functions there are sections on default arguments and keyword arguments, yet I don't see the syntactic difference between them. For default arguments the tutorial shows: def...
41
by: AngleWyrm | last post by:
I have created a new container class, called the hat. It provides random selection of user objects, both with and without replacement, with non-uniform probabilities. Uniform probabilities are a...
22
by: Ook | last post by:
We have had a discussion on the differences between a class and a structure, and no one is in agreement. As I understand it, a structure defaults to public, a class defaults to private. There are...
6
by: Robert | last post by:
Hello. I have been trying out the Lebans ToolTip Classes at http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a form. The classes I am using are located at...
5
by: Chris | last post by:
Hi, I don't get the difference between a struct and a class ! ok, I know that a struct is a value type, the other a reference type, I understand the technical differences between both, but...
0
by: Stephen Horne | last post by:
I've only very recently started with .NET, and need to use some existing container libraries in new code. I'd like to minimise the amount of porting, but of course these containers are not designed...
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
7
by: ademirzanetti | last post by:
Hi there !!! I would like to listen your opinions about inherit from a STL class like list. For example, do you think it is a good approach if I inherit from list to create something like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.