unique_ptr is NOT just for heap allocations | custom deleters

Описание к видео unique_ptr is NOT just for heap allocations | custom deleters

Define your own deleter.

The smart pointer type unique_ptr is NOT just for automating deletes of heap-allocated pointers. By specifying a custom deleter type, you can use them to clean up any resource that doesn't clean up after itself. Yes, you can delete a new, but you can also free a malloc, fclose an fopen, or deallocate an allocate for a custom allocator type (feel free to use a stack allocator!). This can be useful for interoperating with C code or code from other languages, as well as to clean up after classes or incidental data structures that don't otherwise clean up after themselves.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
unique_ptr intro video:    • unique_ptr: C++'s simplest smart pointer  

SUPPORT ME ⭐
---------------------------------------------------
Sign up on Patreon to get your donor role and early access to videos!
  / mcoding  

Feeling generous but don't have a Patreon? Donate via PayPal! (No sign up needed.)
https://www.paypal.com/donate/?hosted...

Want to donate crypto? Check out the rest of my supported donations on my website!
https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, Neel R, Matt R, Johan A, Casey G, Mark M, Mutual Information, Pi

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  

Комментарии

Информация по комментариям в разработке