随笔分类 -  C++

描述C++基础知识
image2
摘要: 阅读全文

posted @ 2024-10-25 15:15 Ultraman_X 阅读(10) 评论(0) 推荐(0) 编辑

image
摘要: 阅读全文

posted @ 2024-03-06 14:23 Ultraman_X 阅读(4) 评论(0) 推荐(0) 编辑

c++ 面试整理
摘要:**如何理解封装、继承、多态** **封装** 可以隐藏实现细节,使得代码模块化;封装是把过程和数据包围起来,对数据的访问只能通过已定义的界面。面向对象计算始于这个基本概念,即现实世界可以被描绘成一系列完全自治、封装的对象,这些对象通过一个受保护的接口访问其他对象。 **多态** 多态指同一个实体同 阅读全文

posted @ 2023-08-19 16:22 Ultraman_X 阅读(23) 评论(0) 推荐(0) 编辑

c++ 多线程
摘要:```cpp #include #include #include #include // std::promise, std::future #include void print_int(std::future& fut) { int x = fut.get(); // 获取共享状态的值. st 阅读全文

posted @ 2023-08-19 09:38 Ultraman_X 阅读(22) 评论(0) 推荐(0) 编辑

c++11 decay/decltype/declval
摘要:decay std::decay对类型进行退化处理。 T为数组U或数组U引用,则type为U*. T为函数时,则type为std::add_pointer::type. 其它类型则移除cv限定符(const和volatile),则type为std::remove_cvstd::remove_refe 阅读全文

posted @ 2022-04-28 10:53 Ultraman_X 阅读(527) 评论(0) 推荐(0) 编辑

避免overloading on universal reference : tag dispatch
摘要:template<typename T> void logAndAdd(T&& name){ logAndAddImpl(std::forward<T>(name),std::is_integral<T>()); } 如果name是个左值(int),则T为int&,这样std::is_integra 阅读全文

posted @ 2022-03-24 18:11 Ultraman_X 阅读(25) 评论(0) 推荐(0) 编辑

gtest的使用
摘要:一、TEST 有两个参数 : test case name 和 test name。test需要归类到test cases。例如: TEST(FactorialTest, Negative) 中 test is named "Negative", "FactorialTest" 是test case 阅读全文

posted @ 2021-12-17 19:11 Ultraman_X 阅读(370) 评论(0) 推荐(0) 编辑

正则表达式
摘要:普通字符: [ABC] [^ABC] [A-Z] [\s\S] \w 特殊字符: $ :匹配输入字符串的结尾位置 ():标记一个子表达式的开始和结束位置 :匹配前面的子表达式零次或多次 +:匹配前面的子表达式一次或多次 ?:匹配前面的子表达式零次或一次 .:匹配除换行符 \n 之外的任何单字符 [: 阅读全文

posted @ 2021-11-01 15:08 Ultraman_X 阅读(38) 评论(0) 推荐(0) 编辑

2021 打算图书清单
摘要:modern-cpp Fundamentals of Computer Graphics Computational Geometry: Algorithms and Applications Physically Based Rendering: From Theory to Implementa 阅读全文

posted @ 2021-09-10 13:52 Ultraman_X 阅读(15) 评论(0) 推荐(0) 编辑

Decuing Types 类型推断
摘要:template<typename T> void f(ParamType param); f(expr); 在编译的时候,编辑器使用expr去推导两个类型:T 和 ParamType。例如: template<typename T> void f(const T& param); int x = 阅读全文

posted @ 2021-08-04 09:59 Ultraman_X 阅读(43) 评论(0) 推荐(0) 编辑

面试题
摘要:11.算法题说思路:一个数组求两个元素差值的绝对值的最大,以及自己方法的复杂度 如果是求绝对值最小呢? 12.算法题还是说思路就好:一个数组求第k大的元素,以及复杂度 1自我介绍(多着重说一些自己擅长的科目,ps:例如我说的是数据结构) 2.项目介绍(看情况,可能会问一到两个项目的具体内容,这个地方 阅读全文

posted @ 2021-07-12 17:07 Ultraman_X 阅读(88) 评论(0) 推荐(0) 编辑

c++函数调用
摘要:Origin 寄存器: stack pointer(ESP): 保存栈的栈顶指针 base pointer (EBP): 保存栈的栈底指针 instruction ponter(EIP): register containing the address of the instruction to b 阅读全文

posted @ 2021-06-23 17:33 Ultraman_X 阅读(165) 评论(0) 推荐(0) 编辑

c++ 运算符重载
摘要:运算符重载的实质是函数重载: 除了类属关系运算符"."、成员指针运算符".*"、作用域运算符"::"、sizeof运算符和三目运算符"?:"以外,C++中的所有运算符都可以重载。 重载运算符限制在C++语言中已有的运算符范围内的允许重载的运算符之中,不能创建新的运算符。 运算符重载实质上是函数重载, 阅读全文

posted @ 2021-06-23 12:03 Ultraman_X 阅读(302) 评论(0) 推荐(0) 编辑

C/C++函数调用过程分析
摘要:#include <stdio.h> int func(int param1 ,int param2,int param3) { int var1 = param1; int var2 = param2; int var3 = param3; printf("var1=%d,var2=%d,var3 阅读全文

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

Virtual Constructor
摘要:Origin ** Intent: ** To create a copy or new object without knowing its concrete type. ** Implementation** : Exploits overloaded methods with polymorp 阅读全文

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

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 阅读(97) 评论(0) 推荐(0) 编辑

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

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

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

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

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 阅读(61) 评论(0) 推荐(0) 编辑

cpp调用函数详细过程
摘要:https://blog.csdn.net/fu_zk/article/details/9798185 阅读全文

posted @ 2021-05-23 14:44 Ultraman_X 阅读(125) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示