我如何知道 C++ 中非静态方法的 return 类型的实际类型和大小?
How do I know the actual type and size of the return type of a non-static method in C++?
在 C++ 中,我们可以在函数的非静态数据成员上使用 sizeof
和 decltype
,但它们都不适用于非静态方法的 return类型,例如decltype(std::vector<int>::size())
、sizeof(std::vector<int>::size())
,这有什么限制的原因吗?或者有一些方法我没有发现?
在 C++ 中,我们可以在函数的非静态数据成员上使用 sizeof
和 decltype
,但它们都不适用于非静态方法的 return类型,例如decltype(std::vector<int>::size())
、sizeof(std::vector<int>::size())
,这有什么限制的原因吗?或者有一些方法我没有发现?