上一页 1 ··· 4 5 6 7 8 9 10 下一页

2021年6月17日

CRTP ( The Curiously Recurring Template Pattern)

摘要: CRTP ( The Curiously Recurring Template Pattern) 什么是CRTP 继承自模板类 子类将自己作为模板参数传递给父类 如下: template <typename T> class Base { ... }; class Derived : public 阅读全文

posted @ 2021-06-17 10:51 Ultraman_X 阅读(87) 评论(0) 推荐(0) 编辑

2021年6月16日

mutable 关键字

摘要: mutable ####理解 mutable字面意思是可变的,其实直接定义的local variable都是可变的,所以mutable对于修饰普通的local variable是没有意义的。事实上,编译器会禁止你这么做: #include <iostream> int main() { mutabl 阅读全文

posted @ 2021-06-16 16:10 Ultraman_X 阅读(208) 评论(0) 推荐(0) 编辑

2021年6月15日

decltype 关键字

摘要: decltype 有的时候我们还会遇到这种情况,我们希望从表达式中推断出要定义变量的类型,但却不想用表达式的值去初始化变量。还有可能是函数的返回类型为某表达式的值类型。在这些时候auto显得就无力了,所以C++11又引入了第二种类型说明符decltype,它的作用是选择并返回操作数的数据类型 dec 阅读全文

posted @ 2021-06-15 18:26 Ultraman_X 阅读(61) 评论(0) 推荐(0) 编辑

2021年6月4日

t

摘要: class Solution { public: bool searchHOne(const vector<vector<int>>& matrix,int h,int s,int e,int target) { if(s > e) return false; if(matrix[h][s] == 阅读全文

posted @ 2021-06-04 18:26 Ultraman_X 阅读(34) 评论(0) 推荐(0) 编辑

2021年6月2日

红黑树 RBTree

摘要: 红黑树 原文 介绍 红黑树也是二叉查找树,我们知道,二叉查找树这一数据结构并不难,而红黑树之所以难是难在它是自平衡的二叉查找树,在进行插入和删除等可能会破坏树的平衡的操作时,需要重新自处理达到平衡状态。现在在脑海想下怎么实现?是不是太多情景需要考虑了?啧啧,先别急,通过本文的学习后,你会觉得,其实也 阅读全文

posted @ 2021-06-02 16:01 Ultraman_X 阅读(50) 评论(0) 推荐(0) 编辑

二叉树类型

摘要: ### 二叉树类型 ##### 满二叉树 (full binary tree): A Binary Tree is a full binary tree if every node has 0 or 2 children ##### 完全二叉树 (complete binary tree): A B 阅读全文

posted @ 2021-06-02 09:37 Ultraman_X 阅读(51) 评论(0) 推荐(0) 编辑

2021年6月1日

trivial default constructors

摘要: 构造函数 A default constructor is trivial if it is not user-provided and if: its class has ** no virtual functions ** and ** no virtual base classes ** an 阅读全文

posted @ 2021-06-01 19:06 Ultraman_X 阅读(56) 评论(0) 推荐(0) 编辑

2021年5月28日

A* PathFinding AStart 算法 一

摘要: AStar pathfinding 参考来源 介绍 😃 寻找从点A(绿色)到点B(红色)之间的路径,蓝色的区域代表这一面墙,无法通过。 寻找路径 从点A开始,把他添加到 ** Open List ** 。这个容器里包含的点可能落在了我们寻找的路径上,也许不会。 检查与开始点相邻或者可以到达开始点的 阅读全文

posted @ 2021-05-28 10:54 Ultraman_X 阅读(229) 评论(0) 推荐(0) 编辑

2021年5月25日

迭代器模式

摘要: 迭代器模式(Iterator) ** 迭代器模式** 是一种行为设计模式, 让你能在不暴露集合底层表现形式 (列表、 栈和树等) 的情况下遍历集合中所有的元素。 😕 问题 大部分集合使用简单列表存储元素。 但有些集合还会使用栈、 树、 图和其他复杂的数据结构。 无论集合的构成方式如何, 它都必须提 阅读全文

posted @ 2021-05-25 11:51 Ultraman_X 阅读(68) 评论(0) 推荐(0) 编辑

2021年5月24日

命令模式

摘要: 命令模式 使用场景 问题 😟 假如你正在开发一款新的文字编辑器, 当前的任务是创建一个包含多个按钮的工具栏, 并让每个按钮对应编辑器的不同操作。 你创建了一个非常简洁的 按钮类, 它不仅可用于生成工具栏上的按钮, 还可用于生成各种对话框的通用按钮。尽管所有按钮看上去都很相似, 但它们可以完成不同的 阅读全文

posted @ 2021-05-24 16:06 Ultraman_X 阅读(82) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 下一页

导航