C++(初级,高级)课程学习笔记
C++学习笔记
try my best c
这个作者很懒,什么都没留下…
展开
-
bind和function实现线程池
绑定器的使用#include<iostream>#include<string>#include<functional>#include<typeinfo>/*C++ 11 bind绑定器 返回的结果还是一个函数对象*/using namespace std;using namespace placeholders;void hello(string str){ cout << str << endl;}i原创 2022-03-10 13:54:52 · 66 阅读 · 0 评论 -
模板的完全特例化和部分特例化
1模板的完全特列化和非完全(部分)特列化模板的推演#include<iostream>#include<string.h>using namespace std;template<typename T>bool compare(T a,T b){ cout<<"T a ,T b"<<endl; return a>b;}template<>bool compare<const char *原创 2022-03-10 13:12:12 · 95 阅读 · 0 评论 -
function实现原理
简单版#include<iostream>#include<typeinfo>#include<string>#include<functional>using namespace std;/*function函数对象类型的实现原理*/void hello(string str){ cout<<str<<endl;}///////////////////////////////////template&原创 2022-03-10 12:16:45 · 81 阅读 · 0 评论 -
C++对象的优化
#include<iostream>using namespace std;class Test{public: Test(int data=10):ma(data) { cout<<"Test(int)"<<endl; } Test(const Test &t):ma(t.ma) { cout<<"Test(const Test&)"<<endl;原创 2022-03-09 21:59:26 · 438 阅读 · 0 评论