在我的项目中包括eigen将标准INT定义为eigen :: denseIndex-如何使用正常INT
Including Eigen in my project redefines the standard int to Eigen::DenseIndex - how to use the normal ints?
我正在尝试创建一个向量来输入.txt文件的某些数据,但是我得到错误:
no operator ">>" matches these operands
operand types are: std::ifstream >> std::vector<Eigen::DenseIndex, std::allocator<Eigen::DenseIndex>>
我的代码是:
dataIn.open("data.txt");
vector<int> hnew;
dataIn >> hnew;
dataIn.close();
data.txt只是空间分离ints的长量向量。我该怎么办?
eigen :: denseIndex只是int的类型别名。这不是问题。
编译器警告您没有超载
template <typename T, typename A>
std::istream & operator >>(std::istream &, std::vector<T. A> &)
默认情况下没有提供。您可以使用istream_iterator构造这样的hnew:
dataIn.open("data.txt");
vector<int> hnew(istream_iterator<int>(dataIn), istream_iterator<int>());
相关文章:
- 为什么在全局范围内使用"extern int a"似乎不行?
- int(c) 和 c-'0' 之间的区别。C++
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 为什么野牛仍在使用"int yylex(void)",却找不到"int yylex(YYS
- Eigen如何在容器循环中干净地附加矩阵
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 当在带有Eigen的C++中使用GDB时,我如何才能看到更多的大矩阵
- 是否可以从int转换为enum类类型
- 不能在初始值设定项列表中将非常量表达式从类型 'int' 缩小到'unsigned long long'
- 向量 <int> a {N, 0} 和 int arr a[N] = {0} 的时间复杂度有什么区别
- 'short int'持有的值溢出,但"自动"不会溢出?
- 如何在C++中将一个无符号的 int 转换为两个无符号的短裤?
- 调用'begin(int [n])'没有匹配函数
- 没有显式声明的int[]中的foreach
- 如何修复 Eigen::<int>NaturalOrdering>::MatrixType' 没有名为 'isCompressed' 的成员
- 在我的项目中包括eigen将标准INT定义为eigen :: denseIndex-如何使用正常INT
- 如何使用另一个"Eigen::VectorXd"向量中的值初始化"Eigen::VectorXd",基于索引的"向量<int>"
- 点云库:如何使用 pcl::addCoordinateSystem(double scale, const Eigen::Affine3f & t, int viewport = 0))
- Eigen::Matrix |为什么Eigen期望int而不是size_t