C++
OarUyGnah
这个作者很懒,什么都没留下…
展开
-
侯捷 c++ 内存管理笔记 p24-p30
std::alloc 运行原理16个指针一开始全为0以后申请内存时优先看已申请为备用的(占备池)进行分配,RoundUp为追加量,,,累计申请量>>4 (/16)原创 2022-02-11 14:35:57 · 491 阅读 · 0 评论 -
bind1st和bind2nd以及c++11 bind 的用法
#include <iostream>#include <functional>#include <algorithm>#include <vector>using namespace std;using namespace std::placeholders;/** * * 原来只能使用bind1st bind2nd绑定 * * c++11使用bind即可 * using namespace std::placeholders;原创 2022-02-07 17:28:13 · 463 阅读 · 0 评论 -
effective C++条款52案例
#include <iostream>using namespace std;class A{public: static void *operator new(std::size_t size) throw(std::bad_alloc) { cout << "A new" << endl; return ::operator new(size); } static void operator de原创 2022-02-03 15:10:30 · 1849 阅读 · 0 评论 -
C++ rb_tree的几种构造方法
在学习rbtree时,看到第四个模板参数为class _Compare,以下为构造rbtree的几种方法#include <iostream>#include <bits/stl_tree.h>#include <functional>using namespace std;template <class T>struct identity : public unary_function<T, T>{ const T &原创 2022-02-02 22:38:32 · 269 阅读 · 0 评论 -
C++ Lambda 表达式作为类模板参数
学习C++ rbtree时发现第四个模板参数为class _Compare,若不使用标准库自带的less<>等模板目前我只发现通过构造类编写operator()或通过std::function<>才能通过编译#include <iostream>#include <deque>#include <bits/stl_tree.h>#include <functional>using namespace std;temp.原创 2022-02-02 22:28:23 · 574 阅读 · 0 评论