C++中依赖受限名称定义编译无法通过的问题

时间:2014-03-30 08:51:16   收藏:0   阅读:500
#include <stdio.h>
#include <iostream>

using namespace std;

template<typename T1>
class A
{
public:
  A(T1 t)
  {}
  
  class AIterator
  {
  }
};

class B
{
public:
  template<typename T1>
  void try()
  {
    A<T1>::AIterator it;
  }
};

以上代码在gcc环境下无法编译通过。

经过查找原因,后来发现:C++中依赖受限名称(使用了::来限定)不能作为类型使用,除非加上typename。

依赖名称:含有模板参数<T1>

受限名称:含有::符号

C++中依赖受限名称定义编译无法通过的问题,布布扣,bubuko.com

原文:http://blog.csdn.net/yahohi/article/details/22532249

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!