Boost logo

Boost :

From: Maxim Egorushkin (e-maxim_at_[hidden])
Date: 2003-03-26 15:14:14

-----Original Message-----
From: Vladimir Prus [mailto:ghost_at_[hidden]]
Sent: Monday, March 24, 2003 10:25 AM
To: Boost mailing list
Subject: Re: [boost] boost::any feature request


P.S. And, BTW, it would be great to see the complete code that you
propose (or
a diff to CVS HEAD).

Here are the sources I played with. It's far from perfect, but I think
the basic idea is clear.

The TailoredAny<> class has the prototype:

template<class NewStrategy_ = Loki::EmptyType, class TypeInfoStrategy_ =
class TailoredAny;

So, it can be parametrized with the type identification strategy, not
the memory allocation strategy only.

And here are the Intel VTune results (see the sources for details):

                                        Creation Assignment
struct 13383 27358
boost::any 3846 331870
TailoredAny<> 9151 310717
TailoredAny<Loki::SmallObject> 3855 110022

If we throw away the type identification strategy and leave it hardcoded
as in the original boost::any the result of the TailoredAny<> will be

Boost list run by bdawes at, gregod at, cpdaniel at, john at