
C++
yzlh2009
这个作者很懒,什么都没留下…
展开
-
std::vector<>的{}用法与stl中的共享指针
vector的{}用法,适用于shared_ptr中,不适用于make_shared中。原创 2024-06-24 09:02:59 · 251 阅读 · 0 评论 -
pcl::PointXYZRGBA造成点云无法显示
pcl::PointXYZRGBA,如果没有rgba信息,显示出来的点云是黑色。原创 2024-06-23 20:49:35 · 417 阅读 · 0 评论 -
关于pcl::ISSKeypoint3D<PointInT, PointOutT>使用中的错误LNK2001
LNK2001 无法解析的外部符号 “private: virtual bool __cdecl pcl::IntegralImageNormalEstimation<struct pcl::PointNormal,struct pcl::Normal>::initCompute(void)” (?initCompute@?$IntegralImageNormalEstimation@UPointNormal@pcl@@UNormal@2@@pcl@@EEAA_NXZ)虽然相关函数放在.hpp原创 2021-06-02 18:29:47 · 461 阅读 · 0 评论 -
ISS得到的关键点和源点云不重合
问题描述如图,pcl中ISS算法得到的关键点(红色)和源点云(绿色)不重合原创 2021-05-26 15:59:28 · 349 阅读 · 0 评论 -
pcl中iss关键点代码分析1
先上代码 Eigen::Matrix3d cov_m = Eigen::Matrix3d::Zero (); getScatterMatrix (static_cast<int> (index), cov_m); Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d> solver (cov_m);pcl::ISSKeypoint3D<PointInT, PointOutT, NormalT>原创 2021-05-24 20:04:49 · 552 阅读 · 1 评论 -
error: ‘Vector‘ is not a member of ‘Eigen‘
错误提示error: ‘Vector’ is not a member of ‘Eigen’解决方法在matrix.h 中加上Vector的定义template <typename Type, int Size>using Vector = Matrix<Type, Size, 1>;这样有可能会出现后续错误。换一个版本Eigen3库,最好是在github库中third_party文件夹中指定的版本。...原创 2021-05-05 18:58:22 · 1628 阅读 · 0 评论 -
reinterpret_cast和static_cast的区别
class A { public: long m_a;}; class B { public: long m_b;}; class C : public A, public B {};int main() { C c; printf("%p, %p, %p", &c, reinterpret_cast<B*>(&c), static_cast <B*>(&c)); }前两个的输出值是相原创 2021-05-02 08:11:49 · 248 阅读 · 0 评论 -
在pybind11中python调用c++程序出现RuntimeWarning: invalid value encountered in
RuntimeWarning: invalid value encountered in less这个警告出现在python中可能是出现了NAN值,在在pybind11中python调用c++程序时出现了0除之类的现象。正常c++程序中出现0除现象,会出现0除中断提示,但在pybind11中python调用c++程序时不会有提示,可能会提示RuntimeWarning: invalid value encountered in less。...原创 2021-02-24 16:25:28 · 1354 阅读 · 0 评论 -
关于stl vector的emplace_back函数参数
元素为内置对象,直接定义元素值int main(int argc, char* argv[]){ vector<int> ps; ps.emplace_back(1); ps.emplace_back(2);}元素为自定义对象,可以先定义对象压入struct P{ P(int x,int y,int z){a[0]=x;a[1]=y;a[2]=z;}; vector<int> a=vector<int>(3);};i原创 2021-02-11 17:18:24 · 2571 阅读 · 0 评论 -
vscode运行,提示undefined reference to main
vscode中使用c++runner插件运行 g++ demo.cundefined reference to maindemo.c中没有main()函数demo.c没有保存使用vscode作为IDE,c++runner插件没有勾选运行前保存全部文件原创 2021-01-26 21:20:28 · 1578 阅读 · 0 评论 -
PCL项目构建时提示Could not find a package configuration file
提示Could not find a package configuration file…Add the installation prefix of “PCL” to CMAKE_PREFIX_PATH or set “PCL_DIR” to a directory containing one of the above files分析出现这个提示,原因一般是库没有安装在默认位置,所以要指定cmake文件的正确位置解决cmake … -DCMAKE_PREFIX_PATH= cmake文件原创 2021-01-15 16:56:53 · 1233 阅读 · 0 评论 -
不使用new调用构造函数
代码#include <vector>#include <array>using namespace std;struct Point{ double x,y,z; Point(){ cout << "no param" << endl; } Point(double x_, double y_,double z_){ x=x_;y=y_;z=z_; cout <&l原创 2021-01-11 17:12:05 · 702 阅读 · 2 评论 -
g++ -std=c++11 类成员变量的默认值和初始化顺序的实验
代码使用 g++ -std=c++11编译以下程序#include<vector>#include<iostream>using namespace std;class MyHashSet { int a = 32; vector<unsigned> buckets; vector<unsigned> masks;public: MyHashSet():buckets(8, false), masks(a){co原创 2021-01-10 16:27:44 · 1833 阅读 · 2 评论 -
c++ STL中vector扩展底层机制的实验
代码#include<vector>int main() { for(int i=0; i<100000; i++){ vector<int> a(100);// cout << a.size()<<endl;// cout << a.capacity()<<endl; a.push_back(18);// cout << a.原创 2021-01-10 09:15:41 · 178 阅读 · 0 评论 -
cannot create std::vector larger than max_size()
class MyHashSet { vector<unsigned> buckets; vector<unsigned> masks; int a = 32;public: MyHashSet():buckets(8, false), masks(a){} };void main(){ MyHashSet* obj = new MyHashSet();}编译通过,运行时提示错误:cannot create std::vector原创 2021-01-09 20:31:02 · 5889 阅读 · 0 评论 -
C++ 类中类的初始化如何调用构造函数?
如果class B中有类型为class A的成员变量,class A的初始化如何调用构造函数?原创 2021-01-09 10:53:02 · 1846 阅读 · 0 评论 -
pcl::console::parse_argument用法
pcl程序中经常用到程序后面带选项,选项解析使用pcl::console::parse_argument()来完成,上代码。example.cpp#include <pcl/console/parse.h>using namespace std;using namespace pcl::console;intmain (int argc, char** argv){ ...原创 2019-12-09 12:19:37 · 3082 阅读 · 0 评论 -
错误 C4430 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
#include <iostream> main (int argc, char** argv){int i;float x; for (int i = 0; i < 3; ++i) { x = 1024 * rand () / (RAND_MAX + 1.0f); } std::cerr << x << std::en...原创 2019-06-16 12:12:14 · 877 阅读 · 0 评论 -
c++中rand()函数每次执行的结果都是一样的吗
程序#include <iostream> main (int argc, char** argv){float x; for (int i = 0; i < 3; ++i) { x = 1024 * rand () / (RAND_MAX + 1.0f); } std::cerr << x << std::endl;...原创 2019-06-16 12:46:34 · 3945 阅读 · 0 评论