c++.stlsoft - [COMSTL; Adi's report] Disallowing empty interface pointer instances
- Matthew (10/14) Dec 02 2006 This is not going to be a simple change. That's not to say I'm averse to...
- Adi Shavit (4/20) Dec 05 2006 This is related to the set() question.
2. In the spirit of RAII, maybe throw an exception (or report some error) if the interface_ptr<> is initialized with NULL/0. This will save a lot of error checking, and make the code clearer. Or maybe make an alternate type that does this, or a policy...This is not going to be a simple change. That's not to say I'm averse to the possibilities of having a policy-based version, but you can see from the definition of stlsoft::ref_ptr - there are two template parameters up to 1.9.1b30; it now has three (for reasons to be discussed later) - that this would not be easily achieved. Ironically, it would have been in interface_ptr. ;-) Can you give me a couple of examples of where this would be necessary? There may be some other way to address the problem. Cheers Matthew
Dec 02 2006
This is related to the set() question. Please see my sample code for an example, where it might have been helpful. Adi Matthew wrote:2. In the spirit of RAII, maybe throw an exception (or report some error) if the interface_ptr<> is initialized with NULL/0. This will save a lot of error checking, and make the code clearer. Or maybe make an alternate type that does this, or a policy...This is not going to be a simple change. That's not to say I'm averse to the possibilities of having a policy-based version, but you can see from the definition of stlsoft::ref_ptr - there are two template parameters up to 1.9.1b30; it now has three (for reasons to be discussed later) - that this would not be easily achieved. Ironically, it would have been in interface_ptr. ;-) Can you give me a couple of examples of where this would be necessary? There may be some other way to address the problem. Cheers Matthew
Dec 05 2006