raii
RAII and C++ STL
I have a case where I wish to store a list of resources in a std::vector. As I see it, my option开发者_如何学JAVAs are as follows:[详细]
2022-12-22 04:02 分类:问答What happens when we combine RAII and GOTO?
I\'m wondering, for no other purpose than pure curiosity (because no one SHOULD EVER write code like this!) about how the behavior of RAII meshes with the use of goto (lovely idea isn\'t it).[详细]
2022-12-22 03:14 分类:问答What is meant by Resource Acquisition is Initialization (RAII)?
What is meant by Resource开发者_如何转开发 Acquisition is Initialization (RAII)?It\'s a really terrible name for an incredibly powerful concept, and perhaps one of the number 1 things that C++ develop[详细]
2022-12-21 13:47 分类:问答Any RAII template in boost or C++0x
Is there any template available in boost for RAII. There are classes like scoped_ptr, shared_ptr which basically work on pointer. Can those classes be used for any other resources other than pointers.[详细]
2022-12-18 01:26 分类:问答Is it abusive to use IDisposable and "using" as a means for getting "scoped behavior" for exception safety?
Something I often used back in C++ was letting a class A handle a state entry and exit condition for another class B, via the A constructor and destructor, to make sure that if something in that scope[详细]
2022-12-17 18:39 分类:问答Is a C++ destructor guaranteed not to be called until the end of the block?
In the C++ code below, am I guaranteed that the ~obj() destructor will be called after the // More code executes? Or is the compiler allowed to destruct the obj object earlier if it detects that it\'s[详细]
2022-12-17 05:50 分类:问答Is there a language with RAII + Ref counting that does not have unsafe pointer arithmetric?
RAII = Resource Acquisition is Initialization Ref Counting = \"poor man\'s GC\" Together, they are quite powerful (like a ref-counted 3D object holding a VBO, which it throws frees when it\'s destru[详细]
2022-12-17 02:59 分类:问答The Price of DuplicateHandle
I\'m writing a class library that provides convenient object-oriented frontends to the C API that is the Windows Registry. I\'m curious, however, what the best course of action is for handling HREGs,[详细]
2022-12-11 19:34 分类:问答Is RAII safe to use in C#? And other garbage collecting languages?
I was making an RAII cl开发者_开发问答ass that takes in a System.Windows.Form control, and sets its cursor.And in the destructor it sets the cursor back to what it was.[详细]
2022-12-11 15:34 分类:问答Adding functionality to a handle wrapper
I have a C++ RAII class for managing Win32 HANDLEs using boost::shared_ptr<> that looks a bit like this:[详细]
2022-12-11 10:54 分类:问答