Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You usually shouldn't use unique_ptr for C api stuff unless you really only need to free it.

Typically though there are custom delete/free API calls you need to make, and to use them with unique_ptr you have to pass that function pointer in as the second argument to the unique_ptr constructor.

At the very least you should have a C++ function that gives you the unique_ptr back that does the right thing; but at that point you almost might as well just make a class and give it member functions to map the C calls.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: