December 02, 2006 [COMSTL; Adi's report] Disallowing empty interface pointer instances | ||||
---|---|---|---|---|
| ||||
> 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
|
December 05, 2006 Re: [COMSTL; Adi's report] Disallowing empty interface pointer instances | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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
>
>
>
|
Copyright © 1999-2021 by the D Language Foundation