Bhupesh-V / 30-seconds-of-cpp

30 Seconds of C++ (STL in C++). Read More about 30C++ here 👉
https://bhupesh-v.github.io/30-Seconds-of-C++/
MIT License
1.45k stars 610 forks source link

Destroy #706

Open Arsivnet opened 1 year ago

Arsivnet commented 1 year ago

This PR adds the destroy() function as defined in https://en.cppreference.com/w/cpp/memory/destroy and https://cplusplus.com/reference/memory/allocator/destroy/ . There's also the destroy_at() function which destroys a single object, but i didn't see it listed on the todo.txt file. I can add a "run code" button if needed, but rextexter with gcc compiler selected didn't recognize the function, even though it works and compiles on my machine.

This is my first contribution, so looking forward to all feedback!

Fixes #31

Changes

I added a destroy.md file which includes a short description as well as a small piece of code as a demonstration of the function. I used the example in cplusplus.com but i changed it a bit to simplify it.

Checklist