Typedef模板的成员类型
Typedef a member type of a template
我有一个这样的公式:
template <typename A, typename B>
struct SomeLibraryClass
{
using Foo = A;
using Bar = B;
};
现在我想使用它,但重命名它,因为概念上的用法是不同的。
template <typename A, typename B>
using quaz = SomeLibraryClass<A, B>;
然而,如果我想要得到bar,它仍然是quaz::bar
。但是我想把quaz::bar
换成quaz::foobar
。这可能吗?为什么或者为什么不呢?
我不能使用继承。
不能添加或删除成员,也不能更改已经定义的类的成员名。你所能做的就是定义一个新的类。
相关文章:
- c++类声明时,相同的例程,不同的成员变量类型
- 错误:请求非类类型为"MULTIMEDIA_FILME [500]"的成员|
- 是否允许类类型的 std::function 成员变量(不完整类型)?
- 无法推断模板化类成员的类型
- 获取"rw_ssid"中成员"长度"的错误请求,该成员属于非类类型"char*"
- static_assert私有类成员的类型,没有实例
- 在运行时选择类成员的类型
- 错误:请求成员 .. 是非类类型"char"
- 如何在 c++ 中为多个类类型指定相同的模板化成员函数?
- 继承类中的 C++ 成员变量类型重写
- 错误:请求"数据"中的成员"大小",其非类类型为"int [5]"
- (2 问题)"类"类型重新定义(即使 #pragma 一次),以及静态函数内的静态成员对象初始化?
- 初始化在类类型 #define 中定义的非静态成员数组,不带默认 ctor
- 避免对非类类型使用指向成员函数的指针
- 初始化与类类型相同的静态成员(静态初始化顺序问题)
- 请求成员 'begin' in 'c' 中,它是非类类型 'char [101]' sort(c.begin(), c
- 如何删除类内类类型的类成员指针
- 如何根据构造函数参数使用超类类型初始化成员变量?
- 如何进行编译时type_check并且仅在类成员的类型与类型匹配时才编译类的一部分?
- 如果类包含基类类型的成员作为第一个元素,后跟其他成员,编译器是否可以优化空基?