
2013/10/8 Bo Peng <elapsing@gmail.com>
This very simple code:
#include <boost/any.hpp> #include <string>
const boost::any getBoolVal() { return false; }
int main() { boost::any vals[] = {1.0, std::string("1m"), getBoolVal()}; }
When built using Visual C++ 2010, it will run into a infinite loop:
<...> Thanks for finding that issue. I'll take care of it. Code at line 70 in boost/any.hpp must look like this: template<typename ValueType> any(ValueType&& value , typename boost::disable_if<boost::is_same<any&, ValueType>
::type* = 0 // disable if value has type `any&` , typename boost::disable_if<boost::is_const<ValueType> ::type* = 0) // disable if value has type `const ValueType&&` : content(new holder< typename remove_reference<ValueType>::type (static_cast<ValueType&&>(value))) { }
Otherwise there'll be infinite loop with `any(const any&&)` and `any::holder(const ValueType&)`, that calls for copy constructor of ValueType. Created a ticket for that bug: https://svn.boost.org/trac/boost/ticket/9215 -- Best regards, Antony Polukhin