Merge pull request #1023 from marzojr/master

Fixing memory handling in E.5 example
This commit is contained in:
Gabriel Dos Reis 2017-09-11 11:22:06 -07:00 committed by GitHub
commit 6d5a219e66

View File

@ -14704,8 +14704,8 @@ Not all member functions can be called.
// if elem != nullptr then elem points to sz doubles
public:
Vector() : elem{nullptr}, sz{0}{}
Vector(int s) : elem{new double}, sz{s} { /* initialize elements */ }
~Vector() { delete elem; }
Vector(int s) : elem{new double[s]}, sz{s} { /* initialize elements */ }
~Vector() { delete [] elem; }
double& operator[](int s) { return elem[s]; }
// ...
private: