![]() |
|
#5
|
||||
|
||||
|
Your coding a wrapper/aggregator for std::unique_ptr is a good choice.
Some types are same, but with different default values and different cleanup APIs. For OpenProcess()/OpenThreadToken() etc., the type is HANDLE, the default value is NULL, the cleanup API is CloseHandle(). For CreateFile()/FindFirstFile()/CreateToolhelp32Snapshot() etc., the type is also HANDLE, but the default value is INVALID_HANDLE_VALUE, and the cleanup API for FindFirstFile() is FindClose(), instead of CloseHandle(). So that's why I use traits/adapter to describe the difference. And, I need the operator&() override to auto reset to the default value when reusing the same UniqueResource variable.
__________________
AKA Solomon/blowfish. |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Resource Manager (.NET) v2 | CodeCracker | Community Tools | 2 | 11-23-2025 22:25 |