Click here to Skip to main content
15,907,326 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralStacked Dialog Pin
Sakusys11-Nov-03 0:31
Sakusys11-Nov-03 0:31 
GeneralActivex and resources Pin
roberto.mdv11-Nov-03 0:23
roberto.mdv11-Nov-03 0:23 
QuestionCan the operator be overloaded in ATL and how? Pin
sqwang10-Nov-03 13:30
sqwang10-Nov-03 13:30 
QuestionHow to gray checkbox in tree control. Pin
shivonkar9-Nov-03 20:00
shivonkar9-Nov-03 20:00 
GeneralSTL question. Pin
WREY9-Nov-03 10:03
WREY9-Nov-03 10:03 
GeneralRe: STL question. Pin
Christian Graus9-Nov-03 10:16
protectorChristian Graus9-Nov-03 10:16 
GeneralRe: STL question. Pin
WREY9-Nov-03 12:11
WREY9-Nov-03 12:11 
GeneralRe: STL question. Pin
ZoogieZork9-Nov-03 13:52
ZoogieZork9-Nov-03 13:52 
Here's some alternatives that should work. I'll leave it up to you to decide which is the appropriate solution based on your design.

In this first one, I'm assuming that you want to clear the string vector instance in the instance of OtherClass that you're adding to pvMyClass. So, we create an instance of OtherClass, clear pvOC in the instance, then duplicate it into pvMyClass (remember, you can only access elements in STL containers by copying, so if you don't want to create a duplicate instance of OtherClass each time, use a vector<OtherClass*> instead).

class MyClass{
    vector<OtherClass> *pvMyClass;
};
MyClass::MyClass(){
    pvMyClass = new vector<OtherClass>;
}
//================
class OtherClass{
    vector<string> *pvOC;
};
OtherClass::OtherClass(){   
    pvOC = new vector<string>;
}
//====================
OtherClass oc = OtherClass();
oc.pvOC->clear();
pvMyClass->push_back(oc);


In this next one, I assume that all instances of OtherClass share that same pvOC, so I make it static.

class MyClass{
    vector<OtherClass> *pvMyClass;
};
MyClass::MyClass(){
    pvMyClass = new vector<OtherClass>;
}
//================
class OtherClass{
    // Make pvOC static.
    static vector<string> *pvOC;
};
// The following is in the implementation.
vector<string> *OtherClass::pvOC =
  new vector<string>;
OtherClass::OtherClass(){   
    // Nothing.
}
//====================
pvMyClass->push_back(OtherClass());
OtherClass::pvOC->clear();



- Mike
GeneralRe: STL question. Pin
WREY9-Nov-03 17:36
WREY9-Nov-03 17:36 
GeneralRe: STL question. Pin
jbarton10-Nov-03 7:25
jbarton10-Nov-03 7:25 
GeneralRe: STL question. Pin
WREY10-Nov-03 7:54
WREY10-Nov-03 7:54 
GeneralRe: STL question. Pin
jbarton11-Nov-03 4:42
jbarton11-Nov-03 4:42 
Generalofstream position and &gt;2GB files Pin
Jeremy Osner7-Nov-03 3:38
Jeremy Osner7-Nov-03 3:38 
GeneralRe: ofstream position and &gt;2GB files Pin
Christian Graus9-Nov-03 10:17
protectorChristian Graus9-Nov-03 10:17 
GeneralRe: ofstream position and &gt;2GB files Pin
Jeremy Osner9-Nov-03 15:50
Jeremy Osner9-Nov-03 15:50 
GeneralTrue C/C++ goodies Pin
TW7-Nov-03 2:01
TW7-Nov-03 2:01 
GeneralSome Problem in Connection Points (MultiClients) Pin
shudingbo7-Nov-03 1:47
shudingbo7-Nov-03 1:47 
QuestionWhere is &lt;Developers Workshop to COM and ATL 3.0 &gt;? Pin
cr9996-Nov-03 17:55
cr9996-Nov-03 17:55 
GeneralATL/WTL DLL and the CMessageLoop* pLoop Pin
bryces6-Nov-03 13:38
bryces6-Nov-03 13:38 
GeneralRe: ATL/WTL DLL and the CMessageLoop* pLoop Pin
Michael Dunn6-Nov-03 16:51
sitebuilderMichael Dunn6-Nov-03 16:51 
Generalmultithreading deque&lt;&gt; question Pin
wibbik6-Nov-03 4:41
wibbik6-Nov-03 4:41 
GeneralRe: multithreading deque&lt;&gt; question Pin
geo_m6-Nov-03 5:26
geo_m6-Nov-03 5:26 
GeneralRe: multithreading deque&lt;&gt; question Pin
valikac6-Nov-03 5:51
valikac6-Nov-03 5:51 
GeneralRe: multithreading deque&lt;&gt; question Pin
Jeff Varszegi6-Nov-03 6:47
professionalJeff Varszegi6-Nov-03 6:47 
GeneralRe: multithreading deque&lt;&gt; question Pin
wibbik6-Nov-03 20:20
wibbik6-Nov-03 20:20 

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.