小编cav*_*ger的帖子

C ++模板类=类型名

什么template <class = typename T::type>意思 您能否介绍我一些描述此规范的博客?

这个问题最初来自于对CPP参考Sfinae的解释

template <typename A>
struct B { typedef typename A::type type; };

template <
  class T,
  class   = typename T::type,      // SFINAE failure if T has no member type
  class U = typename B<T>::type    // hard error if T has no member type
                                   // (guaranteed to not occur as of C++14)
> void foo (int);
Run Code Online (Sandbox Code Playgroud)

c++ templates

5
推荐指数
1
解决办法
1216
查看次数

标签 统计

c++ ×1

templates ×1