|
From: Gerhard Wolf on 13 Nov 2007 08:53 Hi, how do i release the allocated memory when using the std::vector? for example: std::vector<int> rv_values; rv_values.push_back(theValue); ? what possible statements does release the memory allocated by rv_values?
From: Chris ( Val ) on 13 Nov 2007 09:23 On Nov 14, 12:53 am, Gerhard Wolf <quisquil...(a)gmx.de> wrote: > Hi, > > how do i release the allocated memory when using the std::vector? > > for example: > std::vector<int> rv_values; > rv_values.push_back(theValue); > ? what possible statements does release the memory allocated by > rv_values? Look up the 'clear()' and 'resize()' members. -- Chris
From: Daniel T. on 13 Nov 2007 12:45 "Chris ( Val )" <chrisval(a)gmail.com> wrote: > Gerhard Wolf <quisquil...(a)gmx.de> wrote: > > how do i release the allocated memory when using the std::vector? > > > > for example: > > std::vector<int> rv_values; > > rv_values.push_back(theValue); > > ? what possible statements does release the memory allocated by > > > > rv_values? > > Look up the 'clear()' and 'resize()' members. If clear() or resize() don't do what you want, then look up the swap trick in (http://www.gotw.ca/gotw/054.htm)
|
Pages: 1 Prev: linker error Next: ADODataSet component in Borland C++ Builder |