Boost::Any ported to D

Aarti_pl aarti at interia.pl
Mon Sep 25 02:13:47 PDT 2006


Lionello Lunesu napisał(a):
> Just for my understanding: is this like std.boxer?
> 
> L.

Yes. But without problems of std.boxer :-)

Problems with std.boxer:

1. I couldn't get information from Box type if Box is empty. There is no 
direct access to data[] property. The only way I could find is invoke on 
Box .toString method and check if returned value is "<empty string>" . 
As you see it's rather obscure.

2. I think that Any implementation is much cleaner. In std.boxer 
implementation box function gets as argument variadic number of 
parameters. Assertion is make if there is more than one parameter 
passed. And arguments type is checked on runtime...

3. Implementation of boxer seems to be much longer. boxer.d is about 29 
Kb, when any.d is just 2Kb (but without unit tests and comments - it 
will be added later)

In other hand I did not test Any with pointer types and other more 
exotic types - i will do it as i will have a little bit of free time :-)

Regards
Marcin Kuszczak



More information about the Digitalmars-d-announce mailing list