AlgebraMaster

Modern C++ 创造非凡 . 改变世界

导航

2024年6月2日 #

Vulkan矩形绘制顺序小坑

摘要: 裁剪坐标不同: 1. vulkan 裁剪坐标Y 朝下,所以下面矩形意义: static std::vector<Vertex> vertices = { {{-0.5f, -0.5f,0}, {1.0f, 0.0f, 0.0f}}, // 左上角 {{0.5f, -0.5f,0}, {0.0f, 1 阅读全文

posted @ 2024-06-02 16:49 gearslogy 阅读(10) 评论(0) 推荐(0) 编辑

2024年2月2日 #

C++ Runtime Reflection

摘要: 参考: 1. A Flexible Reflection System in C++: Part 1 (preshing.com) 2. C++ Reflection | Austin Brunkhorst 2做的更好。反射的代码是自动生成的。 其实还有个做法,C++ 代码里嵌个pythonVM,天 阅读全文

posted @ 2024-02-02 10:30 gearslogy 阅读(13) 评论(0) 推荐(0) 编辑

2023年8月15日 #

QML NextQT

摘要: 2017 年我写了一篇QML从入门到放弃 如今2023年,过去6年了。QML是我认为真正革命GUI技术 拥抱QML,拥抱声明式GUI. QWidget彻底成为过去式了 1. Property Binding 比如画布有2个盒子AB,A盒子变化大小,B盒子跟着一起干,这个在Qt就直接绑定完事 Rect 阅读全文

posted @ 2023-08-15 15:30 gearslogy 阅读(31) 评论(0) 推荐(0) 编辑

2023年6月19日 #

随手 HDK门格海绵

摘要: 阅读全文

posted @ 2023-06-19 03:55 gearslogy 阅读(53) 评论(0) 推荐(0) 编辑

2023年4月2日 #

clang reflection

摘要: 生成注释 假设有下面的源码: struct Vec3 { float x, y, z; }; struct Vec4 { float x, y, z, w; }; 生成这样的代码: //[[CLASS INFO]] class:Vec3, is pod:true, is aggregate:true 阅读全文

posted @ 2023-04-02 10:01 gearslogy 阅读(110) 评论(0) 推荐(0) 编辑

2023年3月13日 #

Master LLVM GEP

摘要: 主要参考<< LLVM Essentials>> 结果发现这书内容太老了,无法编译。 然后某种情况下写对了,各种崩溃。 丝滑解决: 1. 先从C来看起来 如果一个函数参数是指针意味着下面: #include <iostream> struct Foo{ int f{0}; }; void acces 阅读全文

posted @ 2023-03-13 00:28 gearslogy 阅读(269) 评论(0) 推荐(0) 编辑

2023年2月12日 #

类型擦除TypeErase

摘要: 来自CppCON2022 通过极其简单的方法实现: 头文件: #pragma once #include <iostream> #include <memory> #include <vector> struct CommandConcept { virtual ~CommandConcept() 阅读全文

posted @ 2023-02-12 22:53 gearslogy 阅读(45) 评论(0) 推荐(0) 编辑

2022年12月26日 #

Qt问题记录

摘要: 1. Q_OBJECT 对std::unique_ptr<A>的前置声明不支持。 需要完整的A type 2. Q_OBJECT不支持C++20 module 3. hpp 如果没有.cpp 编译不支持Q_OBJECT 如下:vmenu.h class PCG_VNodeContextMenu : 阅读全文

posted @ 2022-12-26 14:56 gearslogy 阅读(37) 评论(0) 推荐(0) 编辑

2022年12月11日 #

现代CPP设计模式

摘要: 所有的都是实验品,也有可能是用来对原作者的表达的另一种见解(反驳)。 开闭原则(参考Design pattern in Modern C++ 20): 我的方案吊打原书。面向对象有时候效率极其低下(当然这里只单纯针对filter,如果工程另外一回事)。下面强迫转换成指针为了保证跟原书那个操作一样,f 阅读全文

posted @ 2022-12-11 03:11 gearslogy 阅读(239) 评论(0) 推荐(0) 编辑

2022年11月23日 #

CPP2nd CRTP Facade 模式

摘要: 书中源码不全,看看我这个? #include <iostream> #include <type_traits> #include <vector> #include <iterator> template<typename Derived, typename Value, typename Cat 阅读全文

posted @ 2022-11-23 04:12 gearslogy 阅读(81) 评论(0) 推荐(0) 编辑