- 博客(5)
- 收藏
- 关注
转载 boost bind/function使用
bind使用bind使用指南function与bind#include <iostream>#include <boost/function.hpp>#include <boost/bind.hpp>using namespace std;class Foo{public: void memberFunc(double d, int i,...
2019-11-05 22:27:58
127
转载 linux下线程的两种封装方式
https://www.cnblogs.com/gaorong/p/6479493.html有一个静态的threadRoutine成员函数,因为C++成员函数缺省的调用方式是__thiscall,成员函数中隐含的第一个参数都是this指针,所以run成员函数不能匹配给pthread_create的形参void *(start_routine) (void ), 这时候就可以传递类的一个静态成员,...
2019-11-05 21:34:38
236
原创 Leetcode 83. 删除排序链表中的重复元素
给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。示例 1:输入: 1->1->2输出: 1->2示例 2:输入: 1->1->2->3->3输出: 1->2->3解法1:双指针法/** * Definition for singly-linked list. * struct ListNode { * ...
2019-10-16 11:27:40
109
1
原创 C++字符串转换为数字
例如,将字符串“12345”转换为整型12345#include <iostream>#include <string>int main() { int number = 0; std::string s = "12345"; for (int i = 0; i < s.length(); i++) { number = number * 10 + ...
2019-10-14 09:46:55
1013
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人