上一页 1 2 3 4 5 6 7 8 ··· 36 下一页
摘要: 一、std::recursive_mutex 递归的独占互斥量 1.std::mutex : 独占互斥量,自己lock了,别人就不能lock了。 2.std::recursive_mutex 递归的独占互斥量 : 允许同一个线程,同一个互斥量多次被 lock(),效率上比 mutex 要差一点。如果 阅读全文
posted @ 2022-12-15 20:49 repinkply 阅读(113) 评论(0) 推荐(0)
摘要: 1.从上节课的一个demo说起。 #include <iostream> #include <future> #include <vector> #include <atomic> #include <thread> using namespace std; std::atomic<int> g_m 阅读全文
posted @ 2022-12-15 15:49 repinkply 阅读(104) 评论(0) 推荐(0)
摘要: 一、std..function #include <iostream> #include <future> #include <vector> #include <map> #include <functional> #include <string> #include <algorithm> #i 阅读全文
posted @ 2022-12-03 23:16 repinkply 阅读(27) 评论(0) 推荐(0)
摘要: 一、类型萃取范例 1.通过萃取接口中的 value 值为true,false 我们就可以萃取出很多有用的信息。 #include <iostream> #include <future> #include <vector> #include <map> #include <functional> # 阅读全文
posted @ 2022-12-03 20:06 repinkply 阅读(130) 评论(0) 推荐(0)
摘要: 一、可变参数函数 1.这种能够接收非固定个数参数的函数就是可变参数函数 2.initializer_list 标准库类型,该类型能够使用的前提条件是:所有的实参类型相同。 二、initializer_list (初始化列表) 1.如果一个函数,它的实参 数量不可预知,但是所有的参数的类型相同,我们就 阅读全文
posted @ 2022-12-03 18:53 repinkply 阅读(161) 评论(0) 推荐(0)
摘要: 一、捕获列表中的 & & : 捕获外部作用域中的所有变量,并作为引用在lambda表达式中使用。按照引用这种捕获方式,会导致lambda表达式包含绑定到局部变量的引用。 #include <iostream> #include <future> #include <vector> #include 阅读全文
posted @ 2022-12-03 17:11 repinkply 阅读(193) 评论(0) 推荐(0)
摘要: #include <iostream> #include <future> #include <vector> #include <map> #include <functional> #include <string> #include <algorithm> using namespace st 阅读全文
posted @ 2022-12-02 23:03 repinkply 阅读(75) 评论(0) 推荐(0)
摘要: #include <iostream> #include <future> #include <vector> #include <map> #include <functional> #include <string> using namespace std; int echovalue(int 阅读全文
posted @ 2022-11-21 18:33 repinkply 阅读(15) 评论(0) 推荐(0)
摘要: users = [ {"name" : "dewei"}, {"name" : "xiaomu"}, {"name" : "asan"} ] users.sort(key=lambda x : x['name']) print(users) # [{'name': 'asan'}, {'name': 阅读全文
posted @ 2022-08-21 15:12 repinkply 阅读(10) 评论(0) 推荐(0)
摘要: 字符串转列表函数 -- split c = 'a|b|c|d' print(c.split('|')) #['a', 'b', 'c', 'd'] print(c.split('|',1)) # ['a', 'b|c|d'] f = 'a~b~c' print(f.split('~')) #['a' 阅读全文
posted @ 2022-08-14 21:10 repinkply 阅读(29) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 36 下一页