关于在vs2013中的一个错误
2015-11-26 21:15
323 查看
原来的代码是:
两句话出现了26个错误:
错误 10 error C2868: “std::iterator_traits<_Iter>::value_type”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 25 error C2868: “std::iterator_traits<_Iter>::reference”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 20 error C2868: “std::iterator_traits<_Iter>::pointer”: 非法的 using 声明语法;应输入限定名 d:\program filess\vc\include\xutility 375 1 charlotte
错误 5 error C2868: “std::iterator_traits<_Iter>::iterator_category”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 15 error C2868: “std::iterator_traits<_Iter>::difference_type”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 1 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 6 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 11 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 16 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 21 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 26 error C2664: “void std::vector<double,std::allocator<_Ty>>::_Construct<_Iter>(_Iter,_Iter,std::forward_iterator_tag)”: 无法将参数 3 从“double”转换为“std::input_iterator_tag” d:\program files\vs\vc\include\vector 766 1 charlotte
错误 9 error C2602: “std::iterator_traits<_Iter>::value_type”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 24 error C2602: “std::iterator_traits<_Iter>::reference”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 19 error C2602: “std::iterator_traits<_Iter>::pointer”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 4 error C2602: “std::iterator_traits<_Iter>::iterator_category”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 14 error C2602: “std::iterator_traits<_Iter>::difference_type”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 8 error C2146: 语法错误: 缺少“;”(在标识符“value_type”的前面) d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 23 error C2146: 语法错误: 缺少“;”(在标识符“reference”的前面) d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 18 error C2146: 语法错误: 缺少“;”(在标识符“pointer”的前面) d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 3 error C2146: 语法错误: 缺少“;”(在标识符“iterator_category”的前面) d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 13 error C2146: 语法错误: 缺少“;”(在标识符“difference_type”的前面) d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 7 error C2039: “value_type”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 22 error C2039: “reference”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 17 error C2039: “pointer”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 2 error C2039: “iterator_category”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 12 error C2039: “difference_type”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 373 1 charlotte
将代码改为:
正确的vector初始化的方法是:
vector<T> v3(a0,a1)不是一种正确的初始化方法,故而出现错误。
<pre name="code" class="cpp">vector<double> vec1(0.1,0.1); vector<double> vec2(0.2,0.2);
两句话出现了26个错误:
错误 10 error C2868: “std::iterator_traits<_Iter>::value_type”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 25 error C2868: “std::iterator_traits<_Iter>::reference”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 20 error C2868: “std::iterator_traits<_Iter>::pointer”: 非法的 using 声明语法;应输入限定名 d:\program filess\vc\include\xutility 375 1 charlotte
错误 5 error C2868: “std::iterator_traits<_Iter>::iterator_category”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 15 error C2868: “std::iterator_traits<_Iter>::difference_type”: 非法的 using 声明语法;应输入限定名 d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 1 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 6 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 11 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 16 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 21 error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 26 error C2664: “void std::vector<double,std::allocator<_Ty>>::_Construct<_Iter>(_Iter,_Iter,std::forward_iterator_tag)”: 无法将参数 3 从“double”转换为“std::input_iterator_tag” d:\program files\vs\vc\include\vector 766 1 charlotte
错误 9 error C2602: “std::iterator_traits<_Iter>::value_type”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 24 error C2602: “std::iterator_traits<_Iter>::reference”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 19 error C2602: “std::iterator_traits<_Iter>::pointer”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 4 error C2602: “std::iterator_traits<_Iter>::iterator_category”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 14 error C2602: “std::iterator_traits<_Iter>::difference_type”不是“std::iterator_traits<_Iter>”基类的成员 d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 8 error C2146: 语法错误: 缺少“;”(在标识符“value_type”的前面) d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 23 error C2146: 语法错误: 缺少“;”(在标识符“reference”的前面) d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 18 error C2146: 语法错误: 缺少“;”(在标识符“pointer”的前面) d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 3 error C2146: 语法错误: 缺少“;”(在标识符“iterator_category”的前面) d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 13 error C2146: 语法错误: 缺少“;”(在标识符“difference_type”的前面) d:\program files\vs\vc\include\xutility 373 1 charlotte
错误 7 error C2039: “value_type”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 372 1 charlotte
错误 22 error C2039: “reference”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 376 1 charlotte
错误 17 error C2039: “pointer”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 375 1 charlotte
错误 2 error C2039: “iterator_category”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 371 1 charlotte
错误 12 error C2039: “difference_type”: 不是“`global namespace'”的成员 d:\program files\vs\vc\include\xutility 373 1 charlotte
将代码改为:
vector<double> vec1={0.1,0.1}; vector<double> vec2={0.2,0.2};则错误消失。
正确的vector初始化的方法是:
vector<T> v1; | vector保存类型为T的对象。默认构造函数v1为空。 |
vector<T> v2(v1); | v2是v1的一个副本。 |
vector<T> v3(n, i); | v3包含n个值为i的元素。 |
vector<T> v4(n); | v4含有值初始化的元素的n个副本。 |
相关文章推荐
- Android篇 ListView 优化笔记
- 4.5方法参数
- 使用SndPlaySound从内存中播放WAV
- 基于int的Linux的经典系统调用实现
- [连载]《C#通讯(串口和网络)框架的设计与实现》- 5.串口和网络统一IO设计
- 约瑟夫报数出列题
- 《leetCode》:Reverse Linked List II
- 图像的频率域高斯低通滤波
- XMPP协议实现原理介绍
- MIT算法导论-第二讲-渐进符号,递归及解法
- Saltstack的Grains和Pillar比较
- android canvas详解
- spring bean 的生存范围 单例 还是原型
- POJ3041Asteroids(最小点覆盖+有点小抽象)
- android学习ScrollView的使用
- SSRF漏洞的挖掘经验
- 1秒钟检查一次记事本进程,没有记事本就启动记事本
- iOS 的 XMPPFramework 简介
- 颜色设置的宏定义
- 单例宏