假设我有许多原子结构,每个都有一个
inner_type
:
struct Atomic1{
using inner_type = int;
};
struct Atomic2{
using inner_type = double;
};
struct Atomic3{
using inner_type = bool;
};
...
我的客户机类是一个可变模板,可以使用上面的一个或多个原子类:
template<class ...AtomicTypeArgPack>
class MyclassAcceptingAtomicTypes;
我有一个相关的泛型类,它接受
Atomic*::inner_type
作为模板参数:
template<class ...InnerTypeArgPack>
class MyclassAcceptingInnerTypes;
定义了我的特定API类,但指定了两种模板类型:
using my_first_class_t = MyclassAcceptingAtomicTypes<Atomic1, Atomic2>;
对于每个特定的类,我还有另一类内部类型:
using my_first_class_inner_types_t = MyclassAcceptingInnerTypes<Atomic1::inner_type , Atomic2::inner_type >;
是否有方法自动生成第二种类型(即
my_first_class_inner_types_t
)从第一次申报(
my_first_class_t
)使用模板元编程/元函数?