什么是“模板T类”?使用所有者= T;”? [英] What is "template<class T> using owner = T;"?

查看:150
本文介绍了什么是“模板T类”?使用所有者= T;”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下摘录自Microsoft gsl 库的 gsl.h https://github.com/microsoft/gsl ):

Below is excerpted from gsl.h of Microsoft's gsl library (https://github.com/microsoft/gsl):

namespace gsl
{
    //
    // GSL.owner: ownership pointers 
    //
    using std::unique_ptr;
    using std::shared_ptr;

    template<class T>
    using owner = T;
    ...
};

我不明白以下别名模板的含义:

I cannot understand what the following alias template means:

template<class T>
using owner = T;

有什么解释吗?

推荐答案

这意味着对于每个 T 所有者< T> 是<$的别名c $ c> T 。

It means that for every T, owner<T> is an alias for T.

这篇关于什么是“模板T类”?使用所有者= T;”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆