【发布时间】:2017-05-18 09:45:08
【问题描述】:
根据标题,当has_type_struct<no_type>肯定是无效类型时,我不明白以下代码如何编译。
template<typename T>
using my_int = int;
struct no_type {};
template<typename T>
struct has_type_struct { using type = typename T::type; };
template<typename T>
using has_type_using = typename T::type;
int main() {
my_int<has_type_struct<no_type>> a; // why does this compile?
//my_int<has_type_using<no_type>>(); // this rightfully does not compile
return 0;
}
【问题讨论】:
标签: c++ templates metaprogramming