Use auto_ptr<> will delete them for you #include using std::wcout; using std::endl; using std::vector; class Foo { public: Foo(int index) : m_index(index) { wcout << L"Creating Foo #" << m_index << endl; } ~Foo() { wcout << L"Destroying Foo #" << m_index << endl; } private: int m_index; }; int _tmain(int argc, _TCHAR* argv[]) { vector< std::auto_ptr< Foo* > > pFooList; for (int i = 0; i < 10; ++i) { pFooList.push_back( std::auto_ptr< Foo* >(new Foo(i))); } /* no need to delete, std::auto_ptr takes care if it for you. //see #include for (int i = 0; i < 10; ++i) { delete pFooList[i]; } */ return 0; }
:cool:
dfields326
Posts
-
Destructors in STL? -
SendMessage()Try This put the address of the string in a DWORD and passes as the LPARAM; DWORD pdwAddress =(DWORD)&myString; SendMessage(MY_MESSAGE, 0, pdwAddress); void CMainFrm::OnMyMessage( WPARAM wParam, LPARAM lParam ) { CString s; s = *(CString *)lParam; }
-
Tapi Programmingfrom what I have read and heard that TurboPower software Asyc Professional is a excellent 3rd part ActiveX or Delphi/C++ Builder VCL component http://www.turbopower.com/products/APAX/ About the only other one out there is SaxComm Objects 7.0 and 8.0 Have used SaxComm Objects 6.0 and 7.0. Well the 6.0 version (non-tapi) control was not bad at all. The 7.0 version I had nearly reverse engineer the ocx file to make it work. Using Duel Interfaces MFC/ATL. thats my 2cents worth on 3rd part TAPI components