为什么非指针std :: any_cast不返回引用?

时间:2020-07-09 15:25:44

标签: c++ reference c++17 stdany

any_cast()函数(例如,对于非常量引用操作数)具有以下签名:

template<class T>
T any_cast(any& operand);

此函数为什么不返回T&-文档中返回的值仅仅是

static_cast<T>(*std::any_cast<U>(&operand))

0 个答案:

没有答案