摘要: 目录常见推导函数的返回值 常见推导 1 auto: 产生拷贝,可以修改 2 auto&: 左值引用,接受左值,可以修改 3 const auto&: const引用,可以接受左右值,不可修改 4 auto&&: 万能引用,可以接受左右值,const引用时不能修改 int a = 100; const 阅读全文
posted @ 2024-03-15 08:47 Getone超 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 目录enum枚举的问题新特性类中常量 enum 枚举的问题 作用域问题,容易引起命名冲突。例如下面无法编译通过的: enum Color { RED, BLUE //重复 }; enum Feeling { EXCITED, BLUE //重复 }; int main() { Color a = B 阅读全文
posted @ 2024-03-14 17:10 Getone超 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 1.常变量 const int i = 10; int const i = 10; 两种表达方式没区别 2.指针与const 如果const位于*的左侧,则const就是用来修饰指针所指向的变量,即指针指向为常量; 如果const位于*的右侧,const就是修饰指针本身,即指针本身是常量。 利用英文 阅读全文
posted @ 2024-03-14 17:08 Getone超 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 目录仿函数类std::function类Lambda类lambda函数 函数对象有这几类: 仿函数类 即重载operator() class FuncObjType { public: void operator() () { cout<<"Hello C++!"<<endl; } }; std:: 阅读全文
posted @ 2024-03-14 17:06 Getone超 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 原子操作 这些组件为细粒度的原子操作提供,允许无锁并发编程。 类型别名 atomic_bool(C++11) std::atomic (typedef) atomic_char(C++11) std::atomic (typedef) atomic_schar(C++11) std::atomic 阅读全文
posted @ 2024-03-14 15:37 Getone超 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 互斥 std::mutex(c++11) 作用:互斥锁,提供一种原子操作,保护共享数据被多个线程访问的安全性 #include <mutex> std::mutex mutex; { std::lock_guard<std::mutex> lock(mutex); // operate data } 阅读全文
posted @ 2024-03-14 15:36 Getone超 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 目录互斥std::mutex(c++11)std::timed_mutex(c++11)std::recursive_mutex(c++11)std::recursive_timed_mutex(c++11)std::shared_mutex(c++17)shared_timed_mutex(C++ 阅读全文
posted @ 2024-03-14 15:35 Getone超 阅读(33) 评论(0) 推荐(0) 编辑
摘要: std::call_once 中定义 template< class Callable, class... Args > void call_once( std::once_flag& flag, Callable&& f, Args&&... args ); 确保函数或者代码片段在在多线程环境下, 阅读全文
posted @ 2024-03-14 15:33 Getone超 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 目录社区参考手册与语言动态c++大牛博客国外国内C++信息收集账号C++开源库地址BoostpocoEigenceresC++ 代码风格参考 社区 purecpp : a cool open source modern c++ community totw: C++ Tips of the Week 阅读全文
posted @ 2024-03-14 15:21 Getone超 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 原理图 一般pcb板的原理图的电源是恒压源 电路定理 1. 欧姆定理 \[R=\frac{U}{I} \]2.戴维宁定理(电压源等效) 任何一个线性有源二端网络对外都可以等效为一个电压源,其中电压源的电动势是该有源二端网络的开路电压,电压源的内阻是有源二端网络除源后的无源二端网络的等效电阻,这就是戴 阅读全文
posted @ 2024-03-14 15:07 Getone超 阅读(7) 评论(0) 推荐(0) 编辑