jarhead
jarhead

Reputation: 1901

Deallocate memory from 2D mixed array and vector

a 2D and 3D array vectors are defined and used throughout a simulation, they are very large in size so deallocation is neccesary.

array<vector<double>, n> A;
array<vector<vector<double>, n>, m> B;

what is the proper way?

Upvotes: 0

Views: 58

Answers (1)

m.s.
m.s.

Reputation: 16334

just let them go out of scope:

{
    array<vector<double>, n> A;
    array<vector<vector<double>, n>, m> B;

    // use arrays ...

} // leave scope, arrays will be deallocated

Upvotes: 3

Related Questions