'std::vector<int>'中没有命名'set'的成员
no member named 'set' in 'std::vector<int>'
我使用QT创建者和Xcode 4.63(osx-mav)
我刚打电话给.set(....)
,收到以下错误
no member named 'set' in 'std::vector<int, std::allocator<int> >
lib似乎有问题,因为我是QT创建者的新手,所以我仍然不知道如何纠正它。(我是c++新手)
#include <cctype>
#include <cmath>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include "console.h"
#include "filelib.h"
#include "grid.h"
#include "gwindow.h"
#include "simpio.h"
#include "vector.h"
using namespace std;
int main() {
vector<int> myVector(10,0);
fstream mystream;
string getStream;
while(getline(mystream,getStream)) {
getline(mystream,getStream);
if(stringToInteger(getStream)>=0 && stringToInteger(getStream)<=9) {
myVector.set(0,(myVector[0]+1))
};
}
return 0;
};
STL中不存在向量的"set"方法。如果您想更改值,可以使用[]运算符:
myVector[0] = myVector[0] + 1;
甚至
myVector[0]++;
相关文章:
- 错误:'class std::unique_ptr<std::set<long unsigned int> >'没有名为 'size' 的成员
- 通过指定 'std::set' 的成员的值来删除该成员
- 如何使用自定义比较器初始化类数据成员,该成员是 std::set
- 更改 std::set 作为成员属性的顺序
- 如何使用C STD :: SET中的迭代器访问成员功能
- Binary_search 在 STL 集中查找 set 的成员函数?
- C++通过ref返回成员的方法和get-set方法之间的差异
- 'std::vector<int>'中没有命名'set'的成员
- 无法访问 std::set 中对象的非常量成员函数C++
- 如何在另一个类数据成员上定义“std::set”排序
- 无效的模板依赖成员函数模板推导 - 认为我正在尝试使用 std::set
- 为什么使用迭代器时无法使用成员函数获取成员变量<set>?
- 擦除 std::set 的最后一个成员
- 我怎样才能指向 std::set 的成员,以便我可以判断该元素是否已被删除
- std::set没有前成员函数和后成员函数,这是设计原因吗
- 为什么我不能在 std::set 中的元素上调用非常量成员函数?
- 将我自己的get/set c++成员函数视为SWIG中的成员变量
- 按索引获取 std::set 成员C++
- std::set 用作静态模板化成员变量
- 类的成员只能通过set和get方法间接访问