c++11 - Call delete on std::vector -
c++11 - Call delete on std::vector -
do have phone call delete on destructor of class uses std::vectors ? if not, why?
for example:
test.h:
class test { private: // signal buffer raw signal , moving average std::vector<double> buffer; // sensor signal buffer ... }
test.cpp:
#include "test.h" test::~test() { // no delete std:vector utilize std memory allocation ??? } test::test() { buffer.reserve(100); // going free memory? }
thanks
no not need explicitly destroy or delete it. vector held value in class, destroyed automatically, , info within vector deleted vector's own destructor.
the term raii, , works well.
c++11 stdvector
Comments
Post a Comment