Declaring of custom deleter is not so pretty, use of decltype()
is faster. std::shared_ptr
is an alternative, but it is larger than std::unique_ptr
. If you don't want to share a pointer, then take a unique_ptr
.
std::unique_ptr
p( ::CommandLineToArgvW( L"cmd.exe p1 p2 p3", &n ), ::LocalFree );