Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 全局范围中的typedef模板_C++_Templates_Scope_Typedef - Fatal编程技术网

C++ 全局范围中的typedef模板

C++ 全局范围中的typedef模板,c++,templates,scope,typedef,C++,Templates,Scope,Typedef,使用模板类,我通常会制作一些typedef 比如: typedef超级简单名称 我通常有两种方式: template <class A, ...> struct Types { typedef ... } template <class A, ...> class Part_Of_Logick { public: typedef ... } 模板 结构类型{ 类型定义。。。 } 模板 类逻辑的第部分{ 公众: 类型定义。。。 } 是

使用模板类,我通常会制作一些typedef 比如:

typedef超级简单名称
我通常有两种方式:

template <class A, ...>
struct Types {
    typedef ...
}

template <class A, ...>
class Part_Of_Logick {
    public:
        typedef ...
}
模板
结构类型{
类型定义。。。
}
模板
类逻辑的第部分{
公众:
类型定义。。。
}
是否可以在全局范围内设置typedefs? 像这样:

template <class A, ...>
typedef ...
模板
类型定义。。。

我理解您的意思是编写一个模板化的
typedef
,该模板将创建第二个模板,并修复第一个模板的一些参数。如果这是一个问题,不,不在当前标准中。在即将推出的c++0x标准中,您将能够执行以下操作:

template <typename A, typename B> a_template;
template <typename T>
using other_template = a_template<T, int>;
模板a\u模板;
模板
使用其他_模板=一个_模板;

我理解您的意思是编写一个模板化的
typedef
,该模板将创建第二个模板,并修复第一个模板的一些参数。如果这是一个问题,不,不在当前标准中。在即将推出的c++0x标准中,您将能够执行以下操作:

template <typename A, typename B> a_template;
template <typename T>
using other_template = a_template<T, int>;
模板a\u模板;
模板
使用其他_模板=一个_模板;

不在C++98中。C++0x将支持这一点。不过,我不能准确地回忆起C++0x语法

干杯


–Alf不在C++98中。C++0x将支持这一点。不过,我不能准确地回忆起C++0x语法

干杯

–阿尔夫