真-大沙子的博客

C++函数模板偏特化问题较为美观的一种解决方案

C++函数模板偏特化问题较为美观的一种解决方案 使std::enable_if_t作为int并带上默认值 template <typename T, typename std::enable_if_t<std::is_integral_v<T>, int> = 0> void foo(T x) {

沙子 发布于 2024-07-07

C++编译期计算的探索

先放个代码在这 解释下次再说吧(摸了 #include <iostream> #include <utility> #include <array> namespace compiling { #define DEF_BINARY_OP(NAME, OP)\ template <auto

沙子 发布于 2023-08-07

代码片段

一些-study项目中有用的代码片段 [C++]生成GUID(仅Windows下可用) #include <objbase.h> GUID CreateGuid() { GUID guid; if (CoCreateGuid(&guid) == S_OK) { re

沙子 发布于 2023-07-06