一个关于boost any的问题
template <typename ValueType>
ValueType AnyCast(Any& operand)
{
ValueType* result = AnyCast<ValueType>(&operand);
if (!result)
{
return ValueType();
}
return *result;
}
在使用的时候
Any anyInt1(10);
printf("%d\n",AnyCast<int>(anyInt1));
AnyCast<int&>(anyInt1) = 20; //这句话编译报错
求大神指点一二