Does boost::any need RTTI?

2019-07-29 02:05发布

问题:

On the Boost web site I found no information regarding the use or RTTI by boost::any.

I read in a few places that this is a requirement, but then I built a simple test project, and it builds both with and without RTTI.

So, is RTTI, with its performance and memory issues, needed by boost::any and similar classes?

回答1:

Since boost 1.57 RTTI is not needed for boost::any. Rememeber that all objects used as boost::any must by copyable.

https://svn.boost.org/trac/boost/ticket/10346