苞米面C++模板库简介
苞米面C++模板库,无需编译,直接包含头文件就可以。所有模板类和算法都包含在bmm名字空间里,例如:bmm::recet。需要C++编译器,支持C++17标准,只依赖C++STL标准模板库。
依赖C++STL标准模板库
使用说明详细情况查看doc/html里的文档。
示例代码
#iclude<iostream>#iclude<vector>#iclude"bmm/recet.hpp"#iclude"bmm/algo.hpp"itmai(itargc,costchar*argv[]){bmm::recet<it>rec={1,2,3,4,5,6,7,8,9,10};std::cout<<"recetexamplebegi"<<std::edl;std::cout<<"beforerecet:";for(autoi:rec)std::cout<<i<<"";std::cout<<std::edl;rec.push(50);std::cout<<"push50"<<std::edl;std::cout<<"afterrecet:";for(autoi:rec)std::cout<<i<<"";std::cout<<std::edl;std::cout<<"recetexampleed"<<std::edl;std::cout<<std::edl;std::cout<<"algoexamplebegi"<<std::edl;std::vector<it>vec={1,2,3,4,5,6,7,8,9,10};it=3;if(bmm::is_i(vec,))std::cout<<"is_i:"<<<<"isivec"<<std::edl;elsestd::cout<<"is_i:"<<<<"isotivec"<<std::edl;itk=10;itadd=50;std::cout<<"if_ibefore:";for(autoi:vec)std::cout<<i<<"";std::cout<<std::edl;bmm::if_i(vec,k,[add](it&i){i+=add;});std::cout<<"if_i"<<k<<"+="<<add<<":";for(autoi:vec)std::cout<<i<<"";std::cout<<std::edl;std::cout<<"algoexampleed"<<std::edl;retur0;}结果
recetexamplebegibeforerecet:10987654321push50afterrecet:501098765432recetexampleedalgoexamplebegiis_i:3isivecif_ibefore:12345678910if_i10+=50:12345678960algoexampleed功能说明所有模板类和算法都包含在bmm名字空间里,例如:bmm::recet
模板类名称文件说明recet<bmm/recet.hpp>最近使用的元素,类似于最近使用的文件算法名称文件说明is_i<bmm/algo.hpp>判断value是否在容器中if_i<bmm/algo.hpp>如果value在容器中则,调用函数__fuc并返回true,否则返回false开源协议MulaPSL-2.0
项目地址GITEE https://gitee.com/chemiya/bmm-cpp










评论