Click here to Skip to main content
15,916,378 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
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 
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 
Hi William,

You may want to change the way that you are declaring your vectors. Under most cases, there is no benefit to declaring a pointer to a vector and then allocating the vector in the constructor. You just end up making the syntax different, and add the need to manually delete the vector in the destructor.

I would end up coding the classes something like this:

#include <vector>

using namespace std;

class OtherClass
{
   vector<string> vOC;

   public:
      void AddString( const char* str )
         {
         vOC.push_back( str );
         }
};

class MyClass
{
   vector<OtherClass> vMyClass;

   public:
      void AddElements();
};


void MyClass::AddElements()
{
   vMyClass.push_back( OtherClass() );
   OtherClass& oc = vMyClass.back();
   oc.AddString( "First" );
   oc.AddString( "Second" );
   oc.AddString( "Third" );
}


int main()
   {
   MyClass mine;
   mine.AddElements();

   return 0;
   }


The cleanup of the vectors is handled automatically, with no need to call delete.

Best regards,
John
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 
GeneralRe: multithreading deque&lt;&gt; question Pin
Giles9-Nov-03 10:55
Giles9-Nov-03 10:55 
GeneralLinker error for vtMissing Pin
nigs_krec6-Nov-03 2:32
nigs_krec6-Nov-03 2:32 

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.