![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
语言
文章平均质量分 50
笔墨遗迹
这个作者很懒,什么都没留下…
展开
-
C++ vector 效率之emplace_back,push_back
emplace_back(…)的效率比push_back(…)高。原创 2022-07-29 17:26:57 · 454 阅读 · 0 评论 -
代码演示:float 是如何存储的,2进制如何还原为float
代码#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>/**演示float是如何存储的*/void float_to_bits(float f_num, char bits[]){ int *f = (int*)(&f_num); for (int i=0; i<32; i++) { bits原创 2021-08-25 08:48:40 · 248 阅读 · 0 评论 -
C++ format string (格式化字符串)
为什么要单独做C++字符串格式化?C++中可以使用stringstream来格式化字符串如下:stringstream sstream;sstream << "I have made " << 500 << " dollars on this product.";string formated_str = sstream.str();但是,这种方式并不好用。有没有类似printf操作的方式呢?在opencv中有类似的封装。怎么做?怎么用?string f原创 2020-09-03 17:23:05 · 7994 阅读 · 1 评论 -
c++ 构造函数执行顺序
#include <iostream>using namespace std;class A {public: A() {cout << "now initialize A.\n";}};class B{public: B(A _a = A()) : a(_a) { cout << "now initialize B." <...原创 2019-11-07 09:00:34 · 562 阅读 · 0 评论 -
c++ template
#include <iostream>using namespace std;//Template1template <typename _T1>class Scaler{private: _T1 mValue;public: Scaler<_T1> operator+(Scaler<_T1> rVin);//...原创 2019-11-06 08:59:29 · 235 阅读 · 0 评论 -
C++ functional callable lambda algorithm
callable#include <iostream>#include <sys/types.h>using std::cout;using std::endl;class Callable{private: int32_t m_id;public: void operator()(int32_t id) { m_...原创 2019-11-06 08:51:15 · 136 阅读 · 0 评论 -
C++ 4种构造函数被调用时机
#include <iostream>#include <vector>#include <map>#include <algorithm>using namespace std;class A{public: A() { cout << "construct a" << en...原创 2019-11-04 17:17:52 · 1617 阅读 · 0 评论