
----- Original Message -----
From: Andrey Semashev <andrey.semashev@gmail.com> To: boost@lists.boost.org Cc: Sent: Sunday, September 4, 2011 10:19 AM Subject: Re: [boost] [any] new version
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.
This is fine as well. However I don't see too much advantage of having one pointer instead of two. The most important is **not reinvent** RTTI as it would not work well. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/