请原谅对 C++ 类型推导的任何无知,但我希望能够携带参数包的定义,以便稍后我可以测试内部类型。这可能吗?就像是:
template <typename... Args> struct Entity {
struct Inner {
typedef Args... entity_args_t;
};
struct SomeOtherInner {
typedef Args... entity_args_t;
};
};
struct ThingA : Entity<int, string> {
};
struct ThingB : Entity<string, string> {
};
//Want to accept variations of Entity<...>::Inner,
//not Entity<...>::SomeOtherInner
template<typename I>
struct is_Entity_Inner {
static const bool value
= is_same<
typename Entity<typename I::entity_args_t...>::Inner
, I
>::value
;
};
哎?非?