• 2024-03-30万能引用
    右值引用用&&符号表示。右值引用主要是绑定到右值上,如:int&&rv=100;看下面函数定义:voidmyfunc(int&&tmprv){cout<<tmprv<<endl;return;}intmain(){myfunc(10);//正确,右值作为实参inti=100;myfunc(i);//错误,右值引用不能接受左值
  • 2023-01-22function
    1#include<iostream>2#include<vector>3#include<list>4#include<map>5#include<set>6#include<string>7#include<algorithm>8#include<
  • 2022-10-26c++ template
    template<typenameT,typenameM>//基本的模板函数和模板类voidtestfunc(Ta,Mb){std::cout<<a<<b<<std::endl;}template<typenameT,typenameN>c
  • 2022-09-24使用coverlet统计单元测试的代码覆盖率
    单元测试是个好东西,可以在一定程度上兜底虽然写单元测试这件事情非常麻烦但是好的单元测试可以显著提高代码质量,减少bug,避免无意中的修改导致其他模块出错写测试