随笔分类 -  C++ 常用函数和操作

这里记录一下STL库中的容器和算法的操作
摘要:all_of 功能描述 如果在[first,last)范围内的数组进行判断, 如果pred返回 返回 否则返回 等同于 参数 first last 数组的范围[first,last) pred 单个参数的函数,接受前面数组给的每个元素,判断并给出返回值 范例 include include incl 阅读全文
posted @ 2018-01-26 15:41 戴怪兽 阅读(679) 评论(0) 推荐(0)
摘要:map<string,function<int(int, int)>> funs = { {"+", add}, {"-", std::minus<int>()},//标准库的函数,参数为两个整数,可以参考前一篇博客 {"/", divide()},//类成员函数 {"*", [](int i,in 阅读全文
posted @ 2017-11-15 20:59 戴怪兽 阅读(1794) 评论(0) 推荐(0)
摘要:#include <functional>#include <iostream> void f(int& n1, int& n2, const int& n3){ std::cout << "In function: " << n1 << ' ' << n2 << ' ' << n3 << '\n' 阅读全文
posted @ 2017-11-14 21:27 戴怪兽 阅读(484) 评论(0) 推荐(0)
摘要:转换一个数变成8进制,则为 cout << oct << x << endl; 转换一个数变为16进制,为 cout << hex << x << endl; 阅读全文
posted @ 2017-11-14 21:10 戴怪兽 阅读(596) 评论(0) 推荐(0)
摘要:objects = main.o kbd.o command.o display.o \ insert.o search.o files.o utils.o edit : $(objects) cc -o edit $(objects) main.o : defs.h kbd.o : defs.h 阅读全文
posted @ 2017-09-29 20:51 戴怪兽 阅读(155) 评论(0) 推荐(0)