Click here to Skip to main content
16,010,268 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: stl map in a DLL... Pin
Matt Gullett7-Nov-02 3:51
Matt Gullett7-Nov-02 3:51 
GeneralRe: stl map in a DLL... Pin
Tim Smith7-Nov-02 3:59
Tim Smith7-Nov-02 3:59 
GeneralRe: stl map in a DLL... Pin
[James Pullicino]7-Nov-02 22:01
[James Pullicino]7-Nov-02 22:01 
GeneralRe: stl map in a DLL... Pin
Alexandru Savescu7-Nov-02 3:39
Alexandru Savescu7-Nov-02 3:39 
GeneralRe: stl map in a DLL... Pin
Matt Gullett7-Nov-02 3:48
Matt Gullett7-Nov-02 3:48 
GeneralRe: stl map in a DLL... Pin
Alexandru Savescu7-Nov-02 3:51
Alexandru Savescu7-Nov-02 3:51 
GeneralRe: stl map in a DLL... Pin
Joaquín M López Muñoz7-Nov-02 8:34
Joaquín M López Muñoz7-Nov-02 8:34 
GeneralRe: stl map in a DLL... Pin
Jörgen Sigvardsson7-Nov-02 12:00
Jörgen Sigvardsson7-Nov-02 12:00 
Another method besides Joaquin suggestion is to utilize the pimpl idiom as mentioned by Herb Sutter (http://gotw.ca[^]) (I believe it's called a compiler firewall in terms of design patterns).

Basically the pimpl (pimpl = pointer to implementation) idiom separates the implementation details from the interface definition.

Look at this class for instance:
class TheClass {
    int member;
public:
    void DoSomething();
};


All that the clients can do is call DoSomething(). Clients can't touch member, but it can still observe it. This means that all changes to the private parts of the class is visible to all clients - thus you'd have to recompile all depending cpp files.

The pimpl idiom eliminates this by putting the implementation details in the cpp file rather than in the h file.

Example:
// Header file
struct Impl; // Forward decl
class TheClass {
     std::auto_ptr<Impl> pimpl;
public:
     TheClass();
     void DoSomething();
};
and
// Cpp file
struct Impl {
     int member;
};
 
TheClass::TheClass() : pimpl(new Impl) { }
void TheClass::DoSomething() { manipulate(pimpl->member); }


Now you can change anything in your implementation details without the clients noticing it.

From this, it's obvious that you should put the STL-containers in the Impl-struct, thus saving yourself some export-problems.

It's a little bit more typing, but it's a clean way to separate interface from implementation - a very big plus in HUGE projects. (Picture the happy faces on 20 programmers in a project after you've fiddle with the private parts of a common class which many source files depend on.. Wink | ;) )

--
standing so tall, the ground behind
no trespassers, on every floor
a garden swing, and another door
she makes it clear, that everything is hers

A place of abode, not far from here, Ms. Van de Veer

GeneralRe: stl map in a DLL... Pin
Tim Smith8-Nov-02 10:11
Tim Smith8-Nov-02 10:11 
GeneralRe: stl map in a DLL... Pin
Jörgen Sigvardsson10-Nov-02 21:34
Jörgen Sigvardsson10-Nov-02 21:34 
GeneralRe: stl map in a DLL... Pin
Joao Vaz11-Nov-02 18:37
Joao Vaz11-Nov-02 18:37 
GeneralRe: stl map in a DLL... Pin
Jörgen Sigvardsson11-Nov-02 21:18
Jörgen Sigvardsson11-Nov-02 21:18 
GeneralRe: stl map in a DLL... Pin
Joao Vaz11-Nov-02 22:06
Joao Vaz11-Nov-02 22:06 
GeneralRe: stl map in a DLL... Pin
Jörgen Sigvardsson11-Nov-02 22:11
Jörgen Sigvardsson11-Nov-02 22:11 
GeneralRe: stl map in a DLL... Pin
Joao Vaz11-Nov-02 22:35
Joao Vaz11-Nov-02 22:35 
GeneralRe: stl map in a DLL... Pin
Jörgen Sigvardsson11-Nov-02 22:44
Jörgen Sigvardsson11-Nov-02 22:44 
GeneralRe: stl map in a DLL... Pin
Joao Vaz11-Nov-02 22:54
Joao Vaz11-Nov-02 22:54 
GeneralATl problem Pin
Bob Davis6-Nov-02 18:51
Bob Davis6-Nov-02 18:51 
GeneralRe: ATl problem Pin
Christian Graus6-Nov-02 19:04
protectorChristian Graus6-Nov-02 19:04 
GeneralRe: ATl problem Pin
Bob Davis6-Nov-02 19:47
Bob Davis6-Nov-02 19:47 
GeneralRe: ATl problem Pin
Jörgen Sigvardsson7-Nov-02 12:05
Jörgen Sigvardsson7-Nov-02 12:05 
QuestionHelp Me,How to return a Interface from a method? Pin
Bob Davis6-Nov-02 17:39
Bob Davis6-Nov-02 17:39 
AnswerRe: Help Me,How to return a Interface from a method? Pin
Christian Graus6-Nov-02 19:10
protectorChristian Graus6-Nov-02 19:10 
AnswerRe: Help Me,How to return a Interface from a method? Pin
Jörgen Sigvardsson7-Nov-02 12:08
Jörgen Sigvardsson7-Nov-02 12:08 
GeneralRe: Help Me,How to return a Interface from a method? Pin
Anders Molin7-Nov-02 15:22
professionalAnders Molin7-Nov-02 15:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.