View Single Post
  #7  
Old 06-12-2024, 19:19
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 468
Rept. Given: 11
Rept. Rcvd 32 Times in 25 Posts
Thanks Given: 69
Thanks Rcvd at 247 Times in 94 Posts
WhoCares Reputation: 32
There is no silver bullet

Such unique/scope resource managers never consider dependencies.

There is also std::experimental::scope_exit() for RAII.


Quote:
Originally Posted by chants View Post
Is it hard to abstract the whole Win API I would think without having a way to define dependencies. Resources sometimes form a hierarchy and have to be closed in that order e.g. CloseServiceHandle on the service then the manager. But it's hard to do as eventually you are doing reference dependency checking similar to a garbage collector. M$FT wrapped the Win API using MFC for that reason as they could construct the hierarchy and encapsulate handles. Not to say this technique isn't usable in some common and simple everyday scenarios.
__________________
AKA Solomon/blowfish.

Last edited by WhoCares; 06-12-2024 at 19:32.
Reply With Quote
The Following User Says Thank You to WhoCares For This Useful Post:
chants (06-13-2024)