Move semantics and Rule of five Move semanticsThe semantics of move is actually to transfer the ownership of resources. 123456789101112131415#include <utility>void Copy(char** dst, char** src, size_t size) { *dst = new 2023-05-13 dev > cpp #cpp #cpp11 #move
Some examples about CTAD CTAD is Class Template Argument Deduction in C++17. With CTAD, we can write so-called deduction guides to tell the compiler how to instantiate a class template. Thanks to CTAD, class templates can loo 2023-05-12 dev > cpp #cpp #cpp17 #template #ctad
Some deduction examples about auto/decltype lvalue12345678910111213int i{0};auto a = i; // intdecltype(auto) b = i; // intauto c = (i); // intdecltype(auto) d = (i); // int&auto& e = i; // int&au 2023-05-11 dev > cpp #cpp #cpp11 #auto #decltype
Introduction to some interesting operator overloads operator""ms / operator""svIn general occasions, we use std::chrono::milliseconds(1024) to indicate a duration about milliseconds. Actually, STL provides another convenient wa 2023-05-10 dev > cpp > overload #cpp #cpp11 #operator #overload
Learn muduo - Part 1 thread_safe Objects Lifecycle Management muduo: https://github.com/chenshuo/muduo 本系列是 《Linux 多线程服务端编程:使用 muduo C++ 网络库》 学习笔记。Part 1: 线程安全的对象生命期管理 线程安全的 Counter1234567891011121314151617181920 2023-05-09 library > muduo #cpp #library #muduo #thread_safe
Genetic Algorithm Code ExampleA genetic algorithm for optimizing the minimum value of a function. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646 2023-05-08 system_design #system_design #genetic_algorithm
与数学有关的悖论 一本相关的书《悖论:破解科学史上最复杂的9大谜团》 真悖论 先有鸡还是先有蛋 时间悖论 祖父悖论:穿越回到过去杀了你年轻的祖父 先知悖论:某人到达未来,得知将发生的不幸结果A,他在现在做出了避免导致结果A的行动,到达结果B。那么结果A在未来根本没有发生,他又是如何得知结果A的呢? 说谎者悖论:“这句话是假的” 认知悖论 蒙提霍尔问题(三门问题) 芝诺悖论 蒙提霍尔问题(三门问题)假 2023-05-07 math > paradox #math #paradox #monty_hall_problem #zeno_paradoxes
Configure Visual Studio Code (VSCode) List some extensions I get used to using. GeneralFontDownload FiraCode font font family setting: ‘Fira Code Retina’, Monaco, ‘Courier New’, monospace’ Theme One Dark Pro: An awesome theme! vscode-ic 2023-05-06 configuration > vscode #configuration #vscode #extension
Configure clang-tidy A .clang-tidy configuration template I prefer to use. 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364---Checks: ' 2023-05-05 configuration > clang #configuration #clang #clang-tidy
Configure clang-format A .clang-format configuration template I prefer to use. 123456789101112131415# .clang-format# Run manually to reformat a file:# clang-format -i --style=file <file># find . -iname '*.cc' 2023-05-04 configuration > clang #configuration #clang #clang-format