OpenCV函数库中C++版本与C版本对比

2024-05-03 15:08

本文主要是介绍OpenCV函数库中C++版本与C版本对比,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

原文来自于:http://blog.csdn.net/fengbingchun/article/details/6177530

C++版本的好处:

1、在于可以尽量避免使用指针这种危险的东西;

2、不用费心去release资源了,因为在其destructor里面,系统会自动帮你搞定。

3、在某些情况下会比C版本运行速度快。

在文件中包含 using namespace cv;

1.        imread(cvLoadImage):loads an image from a file;

2.        imshow(cvShowImage):displays an image in the specifiedwidow;

3.        waitKey(cvWaitKey):waits for a pressed key;

4.        cvtColor(cvCvtColor):converts an image from one colorspace to another;

5.        reduce(cvReduce):reduces a matrix to a vector;

6.        minMaxLoc(cvMinMaxLoc):finds the global minimum andmaximum in a whole array or sub-array;

7.        namedWindow(cvNamedWindow):creates a window;

8.        destroyWindow(cvDestroyWindow):destroys a window;

9.        destroyAllWindows(cvDestroyAllWindows):destroys all of the HighGUIwindows;

10.    imwrite(cvSaveImage):saves an image to a specified file;

11.    resize(cvResize):resizes an image;

12.    pyrDown(cvPyrDown):blurs an image and downsamples it;

13.    pyrUp(cvPyrUp):upsamples an image and then blursit;

14.    threshold(cvThreshold):applies a fixed-level threshold toeach array element;

15.    adaptiveThreshold(cvAdaptiveThreshold):applies an adaptive threshold toan array;

16.    VideoCapthure::open(cvCaptureFromFile):open video file or a capturingdevice for video capturing;

17.    VideoCapture::isOpened:returns true if video capturinghas been initialized already;

18.    VideoCapture::release(cvReleaseCapture):closes video file or capturingdevice;

19.    VideoCapture::grab(cvGrabFrame):grabs the next frame from videofile or capturing device;

20.    VideoCaputre::retrieve(cvRetrieveFrame):decodes and returns the grabbedvideo frame;

21.    VideoCapture::read(cvQueryFrame):grabs,decodes and returns the nextvideo frame;

22.    VideoCapture::get(cvGetCaptureProperty):returns the specified VideoCaptureproperty;

23.    VideoCapture::set(cvSetCaptureProperty):sets a property in theVideoCapture;

24.    VideoWriter::open:initializes or reinitializes videowriter;

25.    VideoWriter::isOpened:returns true if video writer hasbeen successfully initialized;

26.    VideoWriter::write:writes the next video frame;

27.    Mat::row:creates a matrix header for thespecified matrix row;

28.    Mat::col:creates a matrix header for thespecified matrix column;

29.    Mat::rowRange:creates a matrix header for thespecified row span;

30.    Mat::colRange:creates a matrix header for thespecified col span;

31.    Mat::diag:extracts a diagonal from a matrix,or creates a diagonal matrix;

32.    Mat::clone:creates a full copy of the arrayand the underlying data;

33.    Mat::copyTo(cvCopy):copies the matrix to another one;

34.    Mat::convertTo(cvConvertScale):converts an array to anotherdatatype with optional scaling;

35.    Mat::assignTo:provides a functional form ofconvertTo;

36.    Mat::setTo:sets all or some of the arrayelements to the specified value;

37.    Mat::reshape:changes the shape and/or thenumber of channels of a 2D matrix without copying the data;

38.    Mat::t:transposes a matrix;

39.    Mat::inv:inverses a matrix;

40.    Mat::mul:performs an element-wisemultiplication or division of the two matrices;

41.    Mat::cross:computes a cross-product of two3-element vectors;

42.    Mat::dot:computes a dot-product of twovectors;

43.    Mat::zeros:returns a zero array of thespecified size and type;

44.    Mat::ones:returns an array of all 1’s of thespecified size and type;

45.    Mat::eye:returns an identity matrix of thespecified size and type;

46.    Mat::create:allocates new array data if needed;

47.    Mat::addref:increments the reference counter;

48.    Mat::release:decrements the reference counterand deallocates the matrix if needed;

49.    Mat::resize:changes the number of matrix rows;

50.    Mat::reserve:reserves space for the certainnumber of rows;

51.    Mat::push_back:adds elements to the bottom of thematrix;

52.    Mat::pop_back:removes elements from the bottomof the matrix;

53.    Mat::locateROI:locates the matrix header within aparent matrix;

54.    Mat::adjustROI:adjusts a submatrix size andposition within the parent matrix;

55.    Mat::operator:extracts a rectangular submatrix;

56.    Mat::operatorCvMat:creates the CvMat header for thematrix;

57.    Mat::operatorIplImage:creates the IplImage header forthe matrix;

58.    Mat::total:returns the total number fo arrayelements;

59.    Mat::isContinuous:reports whether the matrix iscontinuous or not;

60.    Mat::elemSize:returns the matrix element size inbytes;

61.    Mat::elemSize1:returns the size of each matrixelement channel in bytes;

62.    Mat::type:returns the type of a matrixelement;

63.    Mat::depth:returns the depth of a matrixelement;

64.    Mat::channels:returns the number of matrix channels;

65.    Mat::step1:returns a normalized step;

66.    Mat::size:returns a matrix size;

67.    Mat::empty:returns true if the array has noelemens;

68.    Mat::ptr:returns a pointer to the specifiedmatrix row;

69.    Mat::at:returns a reference to thespecified array element;

70.    Mat::begin:returns the matrix iterator andsets it to the first matrix element;

71.    Mat::end:returns the matrix iterator andsets it to the after-last matrix element;

72.    calcHist(cvCalcHist):calculates a histogram of a set ofarrays;

73.    compareHist(cvCompareHist):compares two histograms;

74.    equalizeHist(cvEqualizeHist):equalizes the histogram of agrayscale image(直方图均衡化);

75.    normalize:normalizes the norm or value rangeof an array;

76.    CascadeClassifier::CascadeClassifier:loads a classifier from a file;

77.    CascadeClassifier::empth:checks whether the classifier hasbeen loaded;

78.    CascadeClassifier::load(cvLoadHaarClassifierCascade):loads a classifier from a file;

79.    CascadeClassifier::read:reads a classifier from aFileStorage node;

80.    CascadeClassifier::delectMultiScale(cvHaarDetectObjects):detects objects of different sizesin the input image(检测图像中的目标);

81.    CascadeClassifier::setImage(cvSetImagesForHaarClassifierCascade):sets an image for detection(隐藏的cascade(hidden cascade)指定图像);

82.    CascadeClassifier::runAt(cvRunHaarClassifierCascade):runs the detector at the specifiedpoint(在给定位置的图像中运行cascade of boosted classifier);

83.    groupRectangles:groups the object candidaterectangles;

84.    split(cvSplit):divides a multi-channel array intoseveral single-channel arrays;

85.    merge(cvMerge):creates one multichannel array outof several single-channel ones;

86.    mixChannels(cvMixChannels):copies specified channels frominput arrays to the specified channels of output arrays;

87.    setMouseCallback(cvSetMouseCallback):sets mouse handler for thespecified window;

88.    bilateralFilter:applies the bilateral filter to animage(双边滤波);

89.    blur(cvSmooth):blurs an image using thenormalized box filter(均值模糊);

90.    medianBlur:blurs an image using the medianfilter(中值模糊);

91.    boxFilter:blurs an image using the boxfilter;

92.    GaussianBlur:blurs an image using a Gaussianfilter(高斯模糊);

93.    getGaussianKernel:returns Gaussian filtercoefficients;

94.    sepFilter2D:applies a separable linear filterto an image;

95.    filter2D(cvFilter2D):convolves an image with the kernel;

96.    norm(cvNorm):calculates an absolute array norm,an absolute difference norm, or a relative defference norm;

97.    flip(cvFlip):filps a 2D array around vertical,horizontal, or both axes;

98.    Algorithm::get:returns the algorithm parameter;

99.    Algorithm::set:set the algorithm parameter;

100. Algorithm::write:stores algorithm parameters in afile storage;

101. Algorithm::read:reads algorithm parameters from afile storage;

102. Algorithm::getList:returns the list of registeredalgorithms;

103. Algorithm::create:creates algorithm instance by name;

104. FaceRecognizer::train:trains a FaceRecognizer with givendata and associated labels;

105. FaceRecognizer::update:updates a FaceRecognizer withgiven data and associated labels;

106. FaceRecognizer::predict:predicts a label and associatedconfidence(e.g. distance) for a given input image;

107. FaceRecognizer::save:saves a FaceRecognizer and itsmodel state;

108. FaceRecognizer::load:loads a FaceRecognizer and itsmodel state;

109. createEigenFaceRecognizer:;

110. createFisherFaceRecognizer:;

111. createBPHFaceRecognizer:;

112. getTextSize(cvGetTextSize):calculates the width and height ofa textstring;

113. putText(cvPutText):draws a text string;

114. getStructuringElement(cvCreateStructingElementEx):returns a structuring element ofthe specified size and shape for morphological operations;

115. morphologyEx(cvMorphologyEx):performs advanced morphologicaltransformations;

116. findContours(cvFindContours):finds contours in a binary image;

117. drawContours(cvDrawContours):draw contours outlines or filledcontours;

118. minAreaRect(cvMinAreaRect2):finds a rotated rectangle of theminimum area enclosing the input 2D point set;

119. floodFill(cvFloodFill):fills a connected component withthe given color;

120. getRectSubPix(cvGetRectSubPix):retrieves a pixel rectangle froman image with sub-pixel accuracy;

121. CvSVM::CvSVM:default and training constructors;

122. CvSVM::train:trains an SVM;

123. CvSVM::train_auto:trains an SVM with optimalparameters;

124. CvSVM::predict:predicts the response for inputsample(s);

125. CvSVM::get_default_grid:generates a grid for SVMparameters;

126. CvSVM::get_params:returns the current SVM parameters;

127. CvSVM::get_support_vector:retrieves a number of supportvectors and the particular vector;

128. CvSVM::get_var_count:returns thenumber of used features(variables count);

129. CvANN_MLP(multi-layerperceptrons)::CvANN_MLP:the constructors;

130. CvANN_MLP::create:constructs MLP with the specifiedtopology;

131. CvANN_MLP::train:trains/updates MLP;

132. CvANN_MLP::predict:predicts responses for inputsamples;

133. CvANN_MLP::get_layer_count:returns the number fo layers inthe MLP;

134. CvANN_MLP::get_layer_size:returns numbers of neurons in eachlayer of the MLP;

135. CvANN_MLP::get_weights:returns neurons weights of theparticular layer;

136. CvKNearest::CvKNearest:default and training constructors;

137. CvKNearest::train:trains the model;

138. CvKNearest::find_nearest:finds the neighbors and predictsresponses for input vectors;

139. CvKNearest::get_max_k:returns the number of maximumneighbors that may be passed to the method CvKNearest::find_nearest();

140. CvKNearest::get_var_count:returns the number of usedfeatures(variables count);

141. CvKNearest::get_sample_count:returns the total number of trainsamples;

142. CvKNearest::is_regression:returns type of the problem(truefor regression and false for classification);

143. HoughLines(cvHoughLines):finds lines in a binary imageusing the standard Hough transform;

144. HoughLinesP:finds line segments in a binaryimage using the probabilistic Hough transform;

145. HoughCircles(cvHoughCircles):finds circles in a grayscale imageusing the Hough transform;

146. line(cvLine):draws a line segment connectingtwo points;

147. fitLine(cvFitLine):fits a line to a 2D or 3D pointset;

148. fitEllipse(cvFitEllipse2):fits an ellipse around a set of 2Dpoints;

149. ellipse(cvEllipse、cvEllipseBox):draws a simple or thick ellipticarc or fills an ellipse sector;

150. boundingRect(cvBoundingRect):calculatesthe up-right bounding rectangle of a point set;

151. rectangle(cvRectangle):draws a simple, thick, or filledup-right rectangle;

152. minEnclosingCircle(cvMinEnclosingCircle):finds acircle of the minimum area enclosing a 2D point set;

153. circle(cvCircle):draw a circle;

154. fillPoly:fills the area bounded by one ormore polygons;

155. approxPolyDP(cvApproxPoly):approximates a polygonal curve(s)with the specified precision;

156. pointPolygonTest(cvPointPolygonTest):performs a point-in-contour test(判断点在多边形中的位置);

157. convexHull(cvConvexHull2):finds the convex hull of a pointset;

158. transpose(cvTranspose):transposes a matrix;

159. invert(cvInvert):finds the inverse orpseudo-inverse of a matrix;

160. getStructuringElement(cvCreateStructuringElementEx):returns a structuring element ofthe specified size and shape for morphological operations;

161. absdiff(cvAbsDiff):calculates the per-elementabsolute difference between two arrays or between an array and a scalar;

162. subtract(cvSub):calculates the per-elementdifference between two arrays or array and a scalar;

163. multiply(cvMul):calculates the per-element scaledproduct fo two arrays;

164. divide(cvDiv):performs per-element division oftwo arrays or a scalar by an array;

165. bitwise_or(cvOr):calculates the per-elementbit-wise disjunction of two arrays or an array and a scalar;

166. bitwise_and(cvAnd):calculates the per-elementbit-wise conjunction of two arrays or an array and a scalar;

167. bitwise_not(cvNot):inverts every bit of an array;

168. bitwise_xor(cvXor):calculates the per-elementbit-wise “exclusive of” operation on two arrays or an array and a scalar;

169. erode(cvErode):erodes an image by using a specificstructuring element;

170. dilate(cvDilate):dilates an image by using aspecific structuring element;

171. min(cvMin):calculates per-element minimum oftwo arrays or an array and a scalar;

172. max(cvMax):calculates per-element maximum oftwo arrays or an array and a scalar;

173. add(cvAdd):calculates the per-element sum oftwo arrays or an array and a scalar;

174. addWeighted(cvAddWeighted):calculates the weighted sum of twoarrays;

175. scaleAdd(cvScaleAdd):calculats the sum of a scaledarray and another array;

176. saturate_cast():template function for accurateconversion from one primitive type to another;

177. sqrt(cvSqrt):calculates a square root of arrayelements;

178. pow(cvPow):raises every array element to apower;

179. abs:calculates an absolute value ofeach matrix element;

180. convertScaleAbs(cvConvertScaleAbs):scales, calculates absolutevalues, and converts the result to 8-bit;

181. cuberoot(cvCbrt):computes the cube root of anargument;

182. exp(cvExp):calculates the exponent of everyarray element;

183. log(cvLog):calculates the natural logarithmof every array element;

184. Canny(cvCanny):finds edges in an image using theCanny algorithm;

185. Sobel(cvSobel):calculates the first, second,third, or mixed image derivatives using an extended Sobel operator;

186. Scharr:Calculates the first x – or y –image derivative using Scharr operator(Scharr 滤波器);

187. Laplacian(cvLaplace):calculates the Laplacian of animage;

188. getDerivKernels:returns filter coefficients forcomputing spatial image derivatives;

189. contourArea(cvContourArea):calculates a contour area;

190. LUT(cvLUT):performs a look-up table transformof an array;

191. calcBackProject(cvCalcBackProject):calculates the back projection ofa histogram(反向投影);

192. arcLength(cvArcLength):calculates a contour perimeter ora curve length;

193. meanShift(cvMeanShift):finds an object on a backprojection image;

194. CamShift(cvCamShift):finds an object center, size, andorientation;

195. TermCriteria:template class definingtermination criteria for iterative algorithms;

196. createTrackbar(cvCreateTrackbar):creates a trackbar and attaches itto the specified window;

197. watershed(cvWatershed):performs a marker-based imagesegmentation using the watershed algorithm;

198. grabCut:runs the GrabCut algorithm;

199. compare(cvCmp):performs the per-elementcomparison of two arrays or an array and scalar value;

200. mean(cvAvg):calculates an average(mean) ofarray elements;

201. meanStdDev(cvAvgSdv):calculates a mean and standarddeviation of array elements;

202. cartToPolar(cvCartToPolar):calculates the magnitude and angleof 2D vectors;

203. moments(cvMoments):calculates all of the moments upto the third order of a polygon or rasterized shape;

204. matchShapes(cvMatchShapes):compares two shapes;

205. cornerHarris(cvCornerHarris):Harris edge detector;

206. goodFeaturesToTrack(cvGoodFeaturesToTrack):determines strong corners on an image;

207. classFeatureDetector:abstract base class for 2D imagefeature detectors;

208. classFastFeatureDetector:wrapping class for featuredetection using the FAST() method;

209. classSURF(SurfFeatureDetector、SurfDescriptorExtractor):extracting Speeded Up Robust Featuresfrom an image;

210. classSIFT(SiftFeatureDetector):extracting keypoints and computingdescriptors using the Scale Invariant Feature Transform(SIFT) algorithm;

211. SURF::operator(cvExtractSURF):detects keypoints and computesSURF descriptors for them;

212. drawKeypoints:draw keypoints;

213. drawMatches:draws the found matches ofkeypoints from two images;

214. classDescriptorMatcher:abstract base class for matchingkeypoint descriptors. It has two groups of match methods,for matchingdescriptors of an image with another image or with an image set;

215. findChessboardCorners(cvFindChessboardCorners):finds the positions of internalcorners of the chessboard;

216. drawChessboardCorners(cvDrawChessboardCorners):renders the detected chessboardcorners;

217. calibrateCamera(cvCalibrateCamera2):finds the camera intrinsic andextrinsic parameters from several view of a calibration pattern;

218. initUndistortRectifyMap(cvInitUndistortMap、cvInitUndistortRectifyMap):computes the undistortion andrectification transformation map;

219. remap(cvRemap):applies a generic geometricaltransformation to an image;

220. calibrationMatrixValues:computes useful cameracharacteristics from the camera matrix;

221. findFundamentalMat(cvFindFundamentalMat):calculates a fundamental matrixfrom the corresponding points in two images;

222. computeCorrespondEpilines(cvComputeCorrespondEpilines):for points in an image of a stereopair, computes the corresponding epilines in the other image;

223. findHomography(cvFindHomography):finds a perspective transformationbetween two planes;

224. warpPerspective(cvWarpPerspective):applies a perspectivetransformation to an image;

225. getPerspectiveTransform(cvGetPerspectiveTransform):calculates a perspective transformfrom four pairs of the corresponding points;

226. cornerSubPix(cvFindCornerSubPix):refines the corner locations;

227. calcOpticalFlowPyrLK(cvCalcOpticalFlowPyrLK):calculates an optical flow for asparse feature set using the iterative Lucas-Kanade method with pyramids;

228. swap:swaps two matrices;

229. accumulateWeighted(cvRunningAvg):updates a running average;

230. classBackgroundSubtractorMOG:gaussian mixture-basedbackground/foreground segmentation algorithm;

231. randu:generates a singleuniformly-distributed(均匀分布) random number or an array ofrandom numbers;

232. randn:fills the array with normallydistributed(正态分布) random numbers;

233. getTickCount:returns the number of ticks;

234. getTickFrequency:returns the number of ticks persecond(使用getTickCount和getTickFrequency两个函数可以计算执行某个算法所用时间);

235. CV_Assert:checks a condition at runtime andthrows exception if it fails;

236. saturate_cast:template function for accurateconversion from one primitive type to another;

237. classRNG:random number generator;

238. RNG::next:returns the next random number;

239. RNG::operatorT:returns the next random number ofthe specified type;

240. RNG::operator():returns the next random number;

241. RNG::uniform:returns the next random numbersampled from the uniform distribution;

242. RNG::gaussian:returns the next random numbersampled from the Gaussian distribution;

243. RNG::fill:fills arrays with random numbers;

244. getOptimalDFTSize(cvGetOptimalDFTSize):returns the optimal DFT size for agiven vector size;

245. copyMakeBorder(cvCopyMakeBorder):forms a border around an image;

246. dft(cvDFT):performs a forward or inverseDiscrete Fourier transform of a 1D or 2D floating-point array;

247. magnitude:calculates the magnitude(幅度) of 2D vectors;

248. classFileStorage:XML/YAML file storage class thanencapsulates all the information necessary for writing or reading data to/froma file;

249. FileStorage::open:open a file;

250. FileStorage::isOpened:checks whether the file is opened;

251. FileStorage::release:closes the file and releases allthe memory buffers;

252. FileStorage::releaseAndGetString:closes the file and releases allthe memory buffers;

253. FileStorage::getFirstTopLevelNode:returns the first element of thetop-level mapping;

254. FileStorage::root:returns the top-level mapping;

255. FileStorage::operator[]:returns the specified element ofthe top-level mapping;

256. FileStorage::operator*:returns the obsolete C FileStorage structure;

257. FileStorage::writeRaw:writes multiple numbers;

258. FileStorage::writeObj:writes the registered C structure(CvMat、CvMatND、CvSeq);

259. FileStorage::getDefaultObjectName:returns the normalized object name for thespecified name of a file;

260. getAffineTransform(cvGetAffineTransform):calculates an affine transformfrom three pairs of the corresponding points;

261. getRotationMatrix2D(cv2DRotationmatrix):calculates an affine matrix of 2Drotation;

262. warpAffine(cvWarpAffine):applies an affine transformationto an image;

263. matchTemplate(cvMatchTemplate):compares a template against overlapped imageregions;

这篇关于OpenCV函数库中C++版本与C版本对比的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/957027

相关文章

【C++ Primer Plus习题】13.4

大家好,这里是国中之林! ❥前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站。有兴趣的可以点点进去看看← 问题: 解答: main.cpp #include <iostream>#include "port.h"int main() {Port p1;Port p2("Abc", "Bcc", 30);std::cout <<

使用opencv优化图片(画面变清晰)

文章目录 需求影响照片清晰度的因素 实现降噪测试代码 锐化空间锐化Unsharp Masking频率域锐化对比测试 对比度增强常用算法对比测试 需求 对图像进行优化,使其看起来更清晰,同时保持尺寸不变,通常涉及到图像处理技术如锐化、降噪、对比度增强等 影响照片清晰度的因素 影响照片清晰度的因素有很多,主要可以从以下几个方面来分析 1. 拍摄设备 相机传感器:相机传

C++包装器

包装器 在 C++ 中,“包装器”通常指的是一种设计模式或编程技巧,用于封装其他代码或对象,使其更易于使用、管理或扩展。包装器的概念在编程中非常普遍,可以用于函数、类、库等多个方面。下面是几个常见的 “包装器” 类型: 1. 函数包装器 函数包装器用于封装一个或多个函数,使其接口更统一或更便于调用。例如,std::function 是一个通用的函数包装器,它可以存储任意可调用对象(函数、函数

C++11第三弹:lambda表达式 | 新的类功能 | 模板的可变参数

🌈个人主页: 南桥几晴秋 🌈C++专栏: 南桥谈C++ 🌈C语言专栏: C语言学习系列 🌈Linux学习专栏: 南桥谈Linux 🌈数据结构学习专栏: 数据结构杂谈 🌈数据库学习专栏: 南桥谈MySQL 🌈Qt学习专栏: 南桥谈Qt 🌈菜鸡代码练习: 练习随想记录 🌈git学习: 南桥谈Git 🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈�

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

06 C++Lambda表达式

lambda表达式的定义 没有显式模版形参的lambda表达式 [捕获] 前属性 (形参列表) 说明符 异常 后属性 尾随类型 约束 {函数体} 有显式模版形参的lambda表达式 [捕获] <模版形参> 模版约束 前属性 (形参列表) 说明符 异常 后属性 尾随类型 约束 {函数体} 含义 捕获:包含零个或者多个捕获符的逗号分隔列表 模板形参:用于泛型lambda提供个模板形参的名

6.1.数据结构-c/c++堆详解下篇(堆排序,TopK问题)

上篇:6.1.数据结构-c/c++模拟实现堆上篇(向下,上调整算法,建堆,增删数据)-CSDN博客 本章重点 1.使用堆来完成堆排序 2.使用堆解决TopK问题 目录 一.堆排序 1.1 思路 1.2 代码 1.3 简单测试 二.TopK问题 2.1 思路(求最小): 2.2 C语言代码(手写堆) 2.3 C++代码(使用优先级队列 priority_queue)

【C++高阶】C++类型转换全攻略:深入理解并高效应用

📝个人主页🌹:Eternity._ ⏩收录专栏⏪:C++ “ 登神长阶 ” 🤡往期回顾🤡:C++ 智能指针 🌹🌹期待您的关注 🌹🌹 ❀C++的类型转换 📒1. C语言中的类型转换📚2. C++强制类型转换⛰️static_cast🌞reinterpret_cast⭐const_cast🍁dynamic_cast 📜3. C++强制类型转换的原因📝

C++——stack、queue的实现及deque的介绍

目录 1.stack与queue的实现 1.1stack的实现  1.2 queue的实现 2.重温vector、list、stack、queue的介绍 2.1 STL标准库中stack和queue的底层结构  3.deque的简单介绍 3.1为什么选择deque作为stack和queue的底层默认容器  3.2 STL中对stack与queue的模拟实现 ①stack模拟实现