how to delete unique_ptr

I was wondering how I would go about deleting just a single member in a unique_ptr array

here is what I have:

1
2
std::unique_ptr<Foo> Blocks[100][100][100];
Blocks[a][b][c] = std::unique_ptr<Foo>(new Foo);


and then I would like to do something equivalent to:

 
delete Blocks[a][b][c];


Thank You.
delete Blocks[a][b][c].release();

http://en.cppreference.com/w/cpp/memory/unique_ptr/release

or, preferred:

Blocks[a][b][c].reset(nullptr);

http://en.cppreference.com/w/cpp/memory/unique_ptr/reset
Last edited on
Topic archived. No new replies allowed.