
C++
文章平均质量分 63
飞虫草大蟹
生于燕赵 求学金陵 未知谋生何处!
展开
-
map查找并修改元素
#include<bits/stdc++.h>using namespace std;void show(map<int,string>& mp){ map<int,string>::iterator iter=mp.begin(); while(iter!=mp.end()) { cout<<iter->first<<" "<<iter->second<<e...转载 2022-02-25 22:18:24 · 1506 阅读 · 0 评论 -
【OpenCV学习2】ROI设置问题
项目开发中使用到opencv,设置roi区域。运行时出现了tombstone。Abort message: 'terminating with uncaught exception of type cv::Exception: external/opencv3/modules/core/src/matrix.cpp:495: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <原创 2022-01-18 15:48:45 · 3264 阅读 · 0 评论 -
find函数使用
总述:以下所讲的所有的string查找函数,都有唯一的返回类型,那就是size_type,即一个无符号整数(按打印出来的算)。若查找成功,返回按查找规则找到的第一个字符或子串的位置;若查找失败,返回npos,即-1(打印出来为4294967295)。1.find()原型://string (1)size_type find (const basic_string& str, size_type pos = 0) const noexcept;//c-string ...转载 2021-09-03 17:46:52 · 871 阅读 · 0 评论 -
C++中string::find()函数和string::npos函数的使用
From:https://www.cnblogs.com/lixuejian/p/10844905.html1. string::find()函数和string::npos函数的介绍我们在学习C++的时候必不可少的使用到string类中的find()函数,它是一个查找函数,功能还是很强大的,但是此处我们不对他进行过多的讲解只是了解它的基本使用,最重要的是和string::npos的关系。string::find()函数:是一个字符或字符串查找函数,该函数有唯一的返回类型,即string:转载 2021-09-03 17:45:33 · 1506 阅读 · 0 评论 -
C++中new是否进行初始化的问题
结论:1、对于有自己写构造函数的类,不论类型名后面有没有括号,都用构造函数进行初始化;2、如果没有构造函数,则不加括号的new只分配内存空间,不进行内存的初始化,3、而加了括号的new会在分配内存的同时初始化为0。例1:#include <iostream> using namespace std; int main(){ int *b=new int[4]; for(int i=0;i<4;i++){ cout<&l转载 2020-09-29 14:51:03 · 562 阅读 · 0 评论