Tag: 相关名称

何处以及为什么必须放置“模板”和“types名称”关键字?

在模板中,为什么我必须将typename名称和template放在相关名称上? 究竟什么是依赖名称呢? 我有以下代码: template <typename T, typename Tail> // Tail will be a UnionNode too. struct UnionNode : public Tail { // … template<typename U> struct inUnion { // Q: where to add typename/template here? typedef Tail::inUnion<U> dummy; }; template< > struct inUnion<T> { }; }; template <typename T> // For the last node Tn. […]