Created
April 30, 2018 13:14
-
-
Save slyshykO/9e91f0a810d0bc8e3e68d9a2232b55a7 to your computer and use it in GitHub Desktop.
RAII malloc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
int main() | |
{ | |
auto Data = | |
std::unique_ptr<double, decltype(free)*>{ | |
reinterpret_cast<double*>(malloc(sizeof(double)*50)), | |
free }; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment