Boost::Any ported to D
Marcin Kuszczak
aarti at interia.pl
Tue Sep 26 14:05:29 PDT 2006
Bruno Medeiros wrote:
> Marcin Kuszczak wrote:
>> 3. I can not compile program after putting PlaceHolder interface and
>> Holder class into Any class (like in the original approach). Is it bug or
>> am I doing something wrong?
>
> Hum, C++ allows member(=inner) classes? Didn't know that. Are they
> static or "instance"(meaning they require an outer class context) classes?
> Recall that in D they are "instance" by default, and static on option
> only.
As I know outer class works just as namespace for inner class. So I would
say static class definitions.
>
>> 4. Why specialization for implicitly instatiated function templates is
>> not possible? (But it is possible to use static if and is operator).
>
> What exactly did you want to do? Is it like the issue here:
> http://d.puremagic.com/issues/show_bug.cgi?id=337 ? Are the workarounds
> there acceptable?
>
I used workaround with static if:
Any assign(ValueType)(ValueType value) {
static if (is(ValueType == Any)) content = value.content!=null ?
value.content.clone() : null;
else content=new Holder!(ValueType)(value);
return this;
}
but why below doesn't work?:
Any assign(ValueType)(ValueType value) {
content=new Holder!(ValueType)(value);
return this;
}
Any assign(ValueType : Any)(ValueType value) {
content = value.content!=null ? value.content.clone() : null;
return this;
}
according to documentation specialization is not permitted when using
implicit instatiation. But still don't know why...
--
Regards
Marcin Kuszczak
(Aarti_pl)
More information about the Digitalmars-d-announce
mailing list