smart pointer

Download Smart pointer

Post on 26-Jun-2015

137 views

Category:

Software

0 download

Embed Size (px)

TRANSCRIPT

  • 1. Smart Pointer

2. Smart Pointer? ~ Smart Pointer 3. Memory Leak CPU Memory 4. Idea 5. Idea 6. Idea 7. Idea 8. Idea 9. Idea 10. Idea 11. Idea 12. auto_ptr 1. 2. Reference Counting 13. shared_ptr 14. unique_ptr Reference Counting 15. shared_ptr 16. default_delete?? 17. My Deleter 18. shared_ptr .. 19. lambda 20. Example : vector 21. Example : vector 22. Example : File Handle 23. Example : Wrapping 24. Example : CreateFileWA 25. Example : CreateFileWA HANDLE hFile = CreateFile() CloseHandle(hFile) FILE* fp = fopen() fclose(fp) Person* p = new Person() delete p winnt.h 26. Example : CreateFileWA