Boost::Any ported to D
Marcin Kuszczak
aarti at interia.pl
Wed Sep 27 11:56:17 PDT 2006
Fredrik Olsson wrote:
> Bruno Medeiros skrev:
>>> 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
>>
> Perhaps a prefix is in order, in your example:
> (new Any).assign(d"char[] test"); // Dynamic
> (new Any).assign(s"char[] test"); // Static
>
> And same for the new array literals (That I love).
> (new Any).assign(d[1,2,3]); // Dynamic
> (new Any).assign(s[1,2,3]); // Static
>
> I guess no prefix would default to static as is?
>
>
> (And before you even think about going about to complain about choosing
> 'd', and 's' as prefixes have in mind: I do not care if any other
> character is used, if it is postfix instead, or whatere. It is the
> functionality I want!)
>
>
> // Fredrik Olsson
Unfortunately this functionality doesn't work with my installed compiler
(dmd 0.167 / Linux) :-( I assume it is a bug?
None of your examples work (I get "undefined identifier d" error)
(new Any).assign(d"char[] test"); // Dynamic
(new Any).assign(s"char[] test"); // Static
(new Any).assign(d[1,2,3]); // Dynamic
(new Any).assign(s[1,2,3]); // Static
Does it work on Windows?
--
Regards
Marcin Kuszczak
(Aarti_pl)
More information about the Digitalmars-d-announce
mailing list