error C2039: “iterator_category”: 不是“Degree”的成员
来源:互联网 发布:cuda 8.0 linux下载 编辑:程序博客网 时间:2024/05/18 02:12
今天真的是十分郁闷,遇到这个名为error C2039: “iterator_category”: 不是“***”的成员,上网谷哥、度娘了一番,得到的结果全是说可能是用的某个名字与库中的重合了,结果试了整整的一个下午加晚上,验证了所有的名字之后,发现问题不是这样的!!!
改后代码:
//vector<Degree> deg;//用来描述从源点source到v的最短路径上权值的上界Degree* deg = new Degree[MAXSIZE];priority_queue<Degree, vector<Degree>, cmp> Q(deg, deg + MAXSIZE);
改前代码:
vector<Degree> deg;//用来描述从源点source到v的最短路径上权值的上界priority_queue<Degree, vector<Degree>, cmp> Q(deg[0], deg[MAXSIZE];错误提示:
1>------ 已启动生成: 项目: Dijkstra, 配置: Debug Win32 ------1> main.cpp1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(373): error C2039: “iterator_category”: 不是“Degree”的成员1> c:\users\chenhq\desktop\dijkstra\dijkstra\degree.h(4) : 参见“Degree”的声明1> d:\program files\microsoft visual studio 10.0\vc\include\vector(550): 参见对正在编译的类 模板 实例化“std::iterator_traits<_Iter>”的引用1> with1> [1> _Iter=Degree1> ]1> d:\program files\microsoft visual studio 10.0\vc\include\queue(247): 参见对正在编译的函数 模板 实例化“std::vector<_Ty>::vector<_Iter>(_Iter,_Iter)”的引用1> with1> [1> _Ty=Degree,1> _Iter=Degree1> ]1> c:\users\chenhq\desktop\dijkstra\dijkstra\dijkstra.h(20): 参见对正在编译的函数 模板 实例化“std::priority_queue<_Ty,_Container,_Pr>::priority_queue<Degree>(_Iter,_Iter)”的引用1> with1> [1> _Ty=Degree,1> _Container=std::vector<Degree>,1> _Pr=cmp,1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(373): error C2146: 语法错误: 缺少“;”(在标识符“iterator_category”的前面)1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(373): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(373): error C2602: “std::iterator_traits<_Iter>::iterator_category”不是“std::iterator_traits<_Iter>”基类的成员1> with1> [1> _Iter=Degree1> ]1> d:\program files\microsoft visual studio 10.0\vc\include\xutility(373) : 参见“std::iterator_traits<_Iter>::iterator_category”的声明1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(373): error C2868: “std::iterator_traits<_Iter>::iterator_category”: 非法的 using 声明语法;应输入限定名1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(374): error C2039: “value_type”: 不是“Degree”的成员1> c:\users\chenhq\desktop\dijkstra\dijkstra\degree.h(4) : 参见“Degree”的声明1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(374): error C2146: 语法错误: 缺少“;”(在标识符“value_type”的前面)1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(374): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(374): error C2602: “std::iterator_traits<_Iter>::value_type”不是“std::iterator_traits<_Iter>”基类的成员1> with1> [1> _Iter=Degree1> ]1> d:\program files\microsoft visual studio 10.0\vc\include\xutility(374) : 参见“std::iterator_traits<_Iter>::value_type”的声明1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(374): error C2868: “std::iterator_traits<_Iter>::value_type”: 非法的 using 声明语法;应输入限定名1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(375): error C2039: “difference_type”: 不是“Degree”的成员1> c:\users\chenhq\desktop\dijkstra\dijkstra\degree.h(4) : 参见“Degree”的声明1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(375): error C2146: 语法错误: 缺少“;”(在标识符“difference_type”的前面)1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(375): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(375): error C2602: “std::iterator_traits<_Iter>::difference_type”不是“std::iterator_traits<_Iter>”基类的成员1> with1> [1> _Iter=Degree1> ]1> d:\program files\microsoft visual studio 10.0\vc\include\xutility(375) : 参见“std::iterator_traits<_Iter>::difference_type”的声明1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(375): error C2868: “std::iterator_traits<_Iter>::difference_type”: 非法的 using 声明语法;应输入限定名1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(377): error C2039: “pointer”: 不是“Degree”的成员1> c:\users\chenhq\desktop\dijkstra\dijkstra\degree.h(4) : 参见“Degree”的声明1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(377): error C2146: 语法错误: 缺少“;”(在标识符“pointer”的前面)1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(377): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(377): error C2602: “std::iterator_traits<_Iter>::pointer”不是“std::iterator_traits<_Iter>”基类的成员1> with1> [1> _Iter=Degree1> ]1> d:\program files\microsoft visual studio 10.0\vc\include\xutility(377) : 参见“std::iterator_traits<_Iter>::pointer”的声明1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(377): error C2868: “std::iterator_traits<_Iter>::pointer”: 非法的 using 声明语法;应输入限定名1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(378): error C2039: “reference”: 不是“Degree”的成员1> c:\users\chenhq\desktop\dijkstra\dijkstra\degree.h(4) : 参见“Degree”的声明1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(378): error C2146: 语法错误: 缺少“;”(在标识符“reference”的前面)1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(378): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(378): error C2602: “std::iterator_traits<_Iter>::reference”不是“std::iterator_traits<_Iter>”基类的成员1> with1> [1> _Iter=Degree1> ]1> d:\program files\microsoft visual studio 10.0\vc\include\xutility(378) : 参见“std::iterator_traits<_Iter>::reference”的声明1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\xutility(378): error C2868: “std::iterator_traits<_Iter>::reference”: 非法的 using 声明语法;应输入限定名1> with1> [1> _Iter=Degree1> ]1>d:\program files\microsoft visual studio 10.0\vc\include\vector(550): error C2664: “void std::vector<_Ty>::_Construct<_Iter>(_Iter,_Iter,std::_Int_iterator_tag)”: 不能将参数 3 从“int”转换为“std::_Int_iterator_tag”1> with1> [1> _Ty=Degree,1> _Iter=Degree1> ]1> 无构造函数可以接受源类型,或构造函数重载决策不明确========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
后来,再看回错误的提示,关注到了这个
1> with1> [1> _Iter=Degree1> ]出现的频率非常之高,我想是不是参数哪里出错了!!坑爹啊,真的是啊
因为是第一次学着用“优先级队列”,还没弄清楚,但是现在知道了一点,后面的参数是要为指针
- error C2039: “iterator_category”: 不是“Degree”的成员
- error C2039: “ReadHuge”: 不是“CFile”的成员
- error C2039: “S_addr” : 不是“in_addr”的成员
- error C2039: “ReadHuge”: 不是“CFile”的成员
- error C2039: “ReadHuge”: 不是“CFile”的成员
- error C2039: “PatchGenerator”: 不是“cv”的成员
- error C2039: “CRegKey”: 不是“ATL”的成员
- error C2039: “ReadHuge”: 不是“CFile”的成员
- error C2039: “WriteHuge”: 不是“CFile”的成员
- error C2039: “sort”: 不是“std”的成员
- error C2039: “ReadHuge”: 不是“CFile”的成员
- error C2039:“Grabber”:不是“pcl”的成员
- vs2008 error C2039: “shared_ptr”: 不是“std::tr1”的成员
- error C2039: “SetWindowTextA”: 不是“ATL::CStringT<BaseType,StringTraits>”的成员
- 关于解决: error C2039: “ReadHuge”: 不是“CFile”的成员
- VS2013 Win8 error C2039: “DOMDocument”: 不是“MSXML2”的成员
- error C2039: “create”: 不是“cocos2d::GLView”的成员,出错解决办法
- error C2039: “create”: 不是“cocos2d::GLView”的成员,出错解决办法
- js继承之-----组合继承
- javaMail实现
- android中的网络通信(二) HTTP网络编程
- C++for语句生命期的问题!
- Cocos2D-HTML5开源2D游戏引擎
- error C2039: “iterator_category”: 不是“Degree”的成员
- 复习C++基础知识-----“我的第一本C++”读书笔记1
- 输入和输出格式:
- TCP端口状态说明ESTABLISHED、TIME_WAIT
- C++获取外部exe程序的返回值
- Windows消息机制
- 【开发工具】分布式编译-IncrediBuild
- 操作码助记符~temp
- LightOJ 1042 Secret Origins(二进制、STL)