为什么在 Ubuntu 上的 NetBeans 中找不到 std::p air
why cannot find std::pair in netbeans on ubuntu
我刚刚在 ubuntu 上的 netbeans 中配置 c/c++当我尝试使用 std::p air 时,编译器似乎找不到它这很奇怪C++ 的默认版本是 C++11我的代码的一部分
int n, k;
cin >> n>>k;
vector<pair<int,int> > x(n);
提前致谢
您需要在
源文件的开头包含正确的头文件,以便编译器知道不同的类型/对象:
#include <iostream> // For std::cin
#include <vector> // For std::vector
#include <utility> // For std::pair
如果需要,默认情况下使用 std 命名空间(通常在 main() 之前):
using namespace std;
相关文章:
- 为什么 const std::p air<K,V>& 在 std::map 上基于范围的 for 循环不起作用?
- C++:无法使用 "=" 运算符更改 std::p air 的值
- 如何在创建自定义迭代器时获得 std::p air 的第一个和第二个?
- 使用 std::p air 进行返回值优化
- 标准::在双类和类的 std::p air 上更大
- 为什么 std::p air 的大小与其元素的大小之和不同?
- 像 std::list<std::p air<string, string>> 这样的结构在返回时会被复制吗?
- 查找 std::vector 中的最小值和最大值 std::p air
- 地图是否将元素存储为 std::p air?
- std::p air 会破坏其动态分配的对象吗?
- 如何在 std::p air 中使用 System::Guid 和自定义枚举?
- boost::mpl 不使用(甚至不兼容)std::p air 的原因是什么?
- 在具有 std::p air 键和值的映射中添加 b2vec2
- 无法访问 std::p air 的成员秒
- 如何在 std::map 中从 std::vector of std::p air 中获取输入?
- 二进制">>":未找到采用类型为"std::p air<int,int>"的右操作数的运算符
- 初始化 std::initializer_list 通过 std:: 初始化 std::p air 在初始化 std::array 时不起作用?
- 通过预处理器创建 std::p air<std::string,some_enum>
- 使用 std::map 和 std::p air 作为键,并将列表作为值
- 为什么 std::map 接受 std::p air 作为密钥,而 std::unordered_map 不接受?