this() member function?

Marcin Kuszczak aarti at interia.pl
Sat Feb 24 14:05:43 PST 2007


Bill Baxter wrote:

> Wei Li wrote:
>> Hi:
>> 
>> The following code is a quick and dirty variant implemention inspired by
>> boost.variant. It works, but why is the constructor(this(T)()) cannot to
>> be a template function?
>> 
>> //variant.d
>> module variant;
>> ...
> 
> So now we have std.boxer, and there's a port of boost::Any floating
> around.  How do all those differ from one another?
> 
> --bb

Let me comment on this:

Boxer - this is done on struct so it is very fast. I would say if it would
be fixed it should be still standard implementation. But there should be
few issues fixed in this implementation:
a. to get information that container is empty you have check if type is
null. There should be really method empty() to check this
b. I would also suggest to add method clear() for consistency
c. There is ugly bug #8 which effectively makes boxer unusable under linux

Any - universal and clean implementation. Unfortunatelly about 10 times
slower than boxer for 'int's...

Variant - Similar to any but you can limit data types stored inside
container to few choosen types.


-- 
Regards
Marcin Kuszczak (Aarti_pl)
-------------------------------------
Ask me why I believe in Jesus - http://zapytaj.dlajezusa.pl (en/pl)
Doost (port of few Boost libraries) - http://www.dsource.org/projects/doost/
-------------------------------------




More information about the Digitalmars-d mailing list