unique_ptr | Unique for autoclose handle

Vitaliy Fadeev vital.fadeev at gmail.com
Thu Dec 15 03:33:31 UTC 2022


On Wednesday, 14 December 2022 at 17:41:07 UTC, Ali Çehreli wrote:
> On 12/14/22 05:58, Vitaliy Fadeev wrote:
> > On Wednesday, 14 December 2022 at 11:30:07 UTC, Vitaliy
> Fadeev wrote:
> >> How to define HANDLE var ?  What to return from procedure?
> How to call
> >> CloseHandle( h ) when variable destroyed?
>
> An obvious way is an RAII type where the destructor calls 
> CloseHandle.
>
> ...
>
> Created 7F1BD5A7D000
> Constructed Handle with 7F1BD5A7D000
> Exiting open_keyboard_device2
> Exiting processDevice
> Closing 7F1BD5A7D000
> Exiting main
>
> Ali

You like a boss, Ali. Thank, Ali!



More information about the Digitalmars-d-learn mailing list