随笔分类 -  C++

摘要:error: jump to label ‘end’ [-fpermissive] end: solution: 所有的变量声明,需要放在'goto'语句之前 阅读全文
posted @ 2024-06-27 17:48 jessicaland 阅读(104) 评论(0) 推荐(0) 编辑
摘要:[root@localhost linux]# gcc main.cpp -L ./ -lcarAnaly -o out /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /tmp/cca7kJoh.o: unde 阅读全文
posted @ 2024-06-27 17:37 jessicaland 阅读(177) 评论(0) 推荐(0) 编辑
摘要:main.cpp:8:14: error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string<char>}’ through ‘...’ printf("%s",s 阅读全文
posted @ 2024-06-27 17:33 jessicaland 阅读(231) 评论(0) 推荐(0) 编辑
摘要:需要注意的编码方式有三处: 操作系统、程序编码(与源文件编码一致)、通信对方传入字符的编码 程序编码(与源文件编码一致) 操作系统编码 对方传入的编码 中文是否ok c2A0编码的空格 utf-8 utf-8 utf-8 ok ok utf-8 gbk gbk 正常中文可以,特殊空格不行 ok 不o 阅读全文
posted @ 2024-03-14 11:43 jessicaland 阅读(98) 评论(0) 推荐(0) 编辑
摘要:// 方法一:调用 length() 或 size() string strTest = "test"; strTest.length(); // 4 strTest.size(); // 4 // 方法二:转为 C 风格字符串,调用 strlen() strlen(strTest.c_str()) 阅读全文
posted @ 2023-04-21 16:06 jessicaland 阅读(60) 评论(0) 推荐(0) 编辑
摘要:1.QString转换String string str = qstr.toStdString(); 2.String转换QString QString qstr = QString::fromStdString(str); 阅读全文
posted @ 2023-04-18 18:47 jessicaland 阅读(204) 评论(0) 推荐(0) 编辑
摘要:Git 基本操作 Git 的工作就是创建和保存你项目的快照及与之后的快照进行对比。 本章将对有关创建与提交你的项目快照的命令作介绍。 Git 常用的是以下 6 个命令:git clone、git push、git add 、git commit、git checkout、git pull,后面我们会 阅读全文
posted @ 2023-04-11 16:17 jessicaland 阅读(15) 评论(0) 推荐(0) 编辑
摘要:// note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA 请注意,Awesomeface.p 阅读全文
posted @ 2022-11-23 15:37 jessicaland 阅读(58) 评论(0) 推荐(0) 编辑
摘要:std::vector<osg::Vec3f>转osg::Vec3Array: std::vector<osg::Vec3f>bufferOutLine; osg::Vec3Array* twoo = new osg::Vec3Array(); for (auto one : bufferOutLi 阅读全文
posted @ 2022-11-23 10:39 jessicaland 阅读(55) 评论(0) 推荐(0) 编辑
摘要:在openGL中,所有图形都是通过分解成三角形的方式进行绘制。(一个矩形分解成两个三角形进行绘制) glDrawArrays 和 glDrawElements 的作用都是从一个数据数组中提取数据渲染基本图元。 一、glDrawArrays(int mode,int first,int count) 阅读全文
posted @ 2022-11-08 14:27 jessicaland 阅读(484) 评论(0) 推荐(0) 编辑
摘要:一般写法,但容易导致值溢出 left + right这步操作有可能导致 int 溢出 int left = 0, right = n, mid; mid = (left + right) / 2; 防止值溢出写法 left加上right减去left差值的一半绝对比left + right安全的多 i 阅读全文
posted @ 2022-10-15 10:27 jessicaland 阅读(77) 评论(0) 推荐(0) 编辑
摘要:1 //文字节点 2 std::vector<GeometricPrimitives*> GP = _dwgData["Axis"]; 3 osg::ref_ptr<osg::Geode> currentLabel = GP->getCurrentLabel(); 4 osg::ref_ptr<os 阅读全文
posted @ 2022-09-22 17:32 jessicaland 阅读(180) 评论(0) 推荐(0) 编辑
摘要:关联式容器multimap与map相似。 multimap 容器具有和 map 相同的特性,即 multimap 容器也用于存储 pair<const K, T> 类型的键值对(其中 K 表示键的类型,T 表示值的类型),其中各个键值对的键的值不能做修改;并且,该容器也会自行根据键的大小对存储的所有 阅读全文
posted @ 2022-08-25 15:52 jessicaland 阅读(138) 评论(0) 推荐(0) 编辑
摘要:STL中的容器按存储方式分为两类:一类是序列容器(如:vector,deque),另一类是关联容器(如:list,map,set)。 (1)对于关联容器(如map,set,multimap,multiset),删除当前的iterator,仅仅会使当前的iterator失效,只要在erase时,递增当 阅读全文
posted @ 2022-08-24 09:21 jessicaland 阅读(393) 评论(0) 推荐(0) 编辑
摘要:continue continue语句用于循环语句中,作用是不执行循环体剩余部分,直接进行下次循环。 常见的就是与if连用。 比如下面这个程序: 1 int main() 2 { 3 int i; 4 for(i = 0; i < 10; i ++) 5 { 6 if(i%2==0) continu 阅读全文
posted @ 2022-08-24 09:17 jessicaland 阅读(601) 评论(0) 推荐(0) 编辑
摘要:同理, continue<break continue--退出当次while,会接着从while循环的开始部分重新执行下来, break--退出while循环,但while循环后面还有其他语句的话,还是会执行 阅读全文
posted @ 2022-08-24 09:15 jessicaland 阅读(82) 评论(0) 推荐(0) 编辑
摘要:正向迭代器: map<int, int>::iterator mit; 反向迭代器: map<int, int>::reverse_iterator rit; 两者相差一个元素,从一个反向迭代器获得对应的正向迭代器需要使用 base() 方法。如下图所示:ri 是指向元素3的反向迭代器,而 i 是 阅读全文
posted @ 2022-08-23 16:09 jessicaland 阅读(127) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示