Boost::Any ported to D
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Tue Sep 26 11:21:19 PDT 2006
Marcin Kuszczak wrote:
>
> I encountered also few problems when porting from C++. Some of them are
> probably bugs, some, maybe are D Language design decisions - I would be
> happy to know how to threat them.
>
> Here are they:
> 1. I couldn't make templatized class constructor
> this(ValueType)(ValueType v);
> It seems that it shouldn't be a problem to support such a construct in
> language - constructor is very similar to method which can be
> templatized.
Indeed.
> 2. Arrays with static size are not fully supported e.g. function can not
> return static array. Also static arrays are not implicitly converted to
> dynamic arrays, so when assigning string to Any class there is a need to
> cast to dynamic array:
> (new Any).assign(cast(char[])("char[] test"));
Static arrays are teh suck. :(
"Certain aspects of D are a pathway to many issues some consider to
be... unnatural." :P
> 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.
> 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?
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-announce
mailing list