hashes of hashes not supported
Maxim Fomin
maxim at maxim-fomin.ru
Fri Nov 9 10:37:18 PST 2012
On Friday, 9 November 2012 at 17:58:27 UTC, Dan wrote:
>>> I don't think making postblit accept const works - did it for
>>> you? If you just mean "this(const this)" it does make it
>>> compile - but that postblit is not called.
>>>
>>
>> Making parameter to be const solves that problem.
>
> Not to me. Sorry if I'm missing something, but a solution would
> be that it not only compile, but it invoke my this(const this)
> postblit, which unless I'm missing something it does not.
>
I understood that the problem is in non-compiling.
>> Look at this: http://dpaste.dzfl.pl/1f60055d. It is a
>> combination of original code and code above. It fails to
>> compile, but commenting this(this) makes dmd happy.
>> Alternatively you can comment S[S[string]] w1, w2 and
>> everything also works fine.
>
> Look at this: http://dpaste.dzfl.pl/95d40612
> I commented out this(this) and dmd is happy, but I am not
> because nothing is printed. This is quite bad because I think
> I'll be duping all my members but it won't get called and
> sharing will ensue. What am I missing?
>
> Thanks,
> Dan
Well actually this(const this) appears to be not a copy
constructor at all - thanks to treating func(Type) {} as
func(Type _param_0){} it is converted to a regular constructor
which may take arbitrary arguments and is irrelevant here. So,
basically the problem is in:
struct S {
this(this) { }
}
void main() {
S[S[string]] w1,w2;
assert(w1==w2); //template instance error instantiating
}
More information about the Digitalmars-d-learn
mailing list