例如
template<class T>
struct Ref
{
using type = T&;
};
< p>对于所有可能的模板参数,Ref<T> ::type
是否与std :: add_lvalue_reference <T> ::type
相同?例如,int
, int&
和int&&
?
我刚刚阅读了std :: add_lvalue_reference <T>
的源代码。非常确定它们是等效的。
如果是这样,我们可以通过简单地编写T&
来节省一些空间。