Ref / NotNull struct
Namespace
rswhite4 at googlemail.com
Tue May 8 15:52:39 PDT 2012
On Tuesday, 8 May 2012 at 16:27:27 UTC, Namespace wrote:
> On Monday, 7 May 2012 at 21:10:17 UTC, Chris Cain wrote:
>> On Monday, 7 May 2012 at 19:36:52 UTC, Namespace wrote:
>>> But apart from that, nor anything else that does not work? :)
>>
>> I put together a few toy examples with it and it seems to work
>> in general otherwise. It might be better if someone has a
>> larger project that they wanted a non-null reference for to
>> get a lot of code tested all at once. Overall, I'm pretty
>> happy with it as long as I don't use UFCS with it.
>>
>> Again, thanks for your efforts developing it :)
>
> Not at all, it was my pleasure. I'm sure you and perhaps others
> will find a few criticisms that can be fixed.
>
> But I have noticed again, that in almost all functions/methods
> of "Proxy" in std.typecons the "inout" is missing. Maybe i
> should open a Bug Report for this.
Another Bug:
If you try to cast a const Ref to his normal object like this
void foo(const Ref!(Foo) rf) {
Foo f = cast(Foo) rf;
}
you get this error
"ref_test.d(121): Error: template
ref_test.Ref!(Foo).Ref.Proxy!(_obj).opCast does
not match any function template declaration
D:\D\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(2796):
Error: template ref
_test.Ref!(Foo).Ref.Proxy!(_obj).opCast(T,this X) cannot deduce
template functio
n from argument types !(Foo)()"
After i changed line 2796 and made the opCast method "inout" it
works as i want.
More information about the Digitalmars-d-learn
mailing list