Skip to content

Instantly share code, notes, and snippets.

@slyshykO
Created April 30, 2018 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slyshykO/9e91f0a810d0bc8e3e68d9a2232b55a7 to your computer and use it in GitHub Desktop.
Save slyshykO/9e91f0a810d0bc8e3e68d9a2232b55a7 to your computer and use it in GitHub Desktop.
RAII malloc
#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