Boost logo

Boost :

Subject: Re: [boost] [any] new version
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2011-09-04 03:19:48


On 09/03/2011 06:25 PM, Artyom Beilis wrote:
>
> linux windows
> boost 8.45 70.8 boost.any 1.46
> any1 8.45 31.4 virtual impl->type() == typeid(Cast)
> any2 3.9 17.1 *this->type_ == typeid(Cast)
> any3 10.15 35.2 strcmp(this->type_->name(),typeid(Cast).name()) == 0
> any4 4.5 12.5 this->type_ ==&typeid(Cast) || *this->type_ == typeid(Cast)
>
>
> The first any implements the Boost.Any method - virtual call to get type
> compare to casted type and then cast.

What if we keep the pointer to the type_info in impl, but make it
directly accessible, not via a virtual call? This would keep sizeof(any)
to one pointer and only add one indirection to any4. IMHO, that would be
the best solution.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk