摘要: 简介 看到一个代码觉得奇怪,顺便看了一下相关的资料. 简而言之,虚继承是对于C++之中的多重继承相关的,消除多重集成共同的父类的变量的奇异性。 参考资料 https://www.cnblogs.com/heyonggang/p/3255155.html 一张图就懂了 阅读全文
posted @ 2021-01-25 20:54 HDU李少帅 阅读(86) 评论(0) 推荐(0)
摘要: 简介 当涉及类对象的排序的时候可以直接构建一个符号重定义函数 比如以set来组织对象的时候,对象最好带一个operator<函数 code /* used to use Vertex as key in a map */ bool operator<(const Vertex&v) const { 阅读全文
posted @ 2021-01-25 20:10 HDU李少帅 阅读(220) 评论(0) 推荐(0)
摘要: 简介 RT code friend std::ostream& operator<<(std::ostream& os, const Vertex& v){ os << "v " << v.X() << ", " << v.Y() << ", " << v.Z(); return os; } 阅读全文
posted @ 2021-01-25 18:56 HDU李少帅 阅读(74) 评论(0) 推荐(0)
摘要: 简介 C++ 元编程 学习之二 参考资料 C++ 模板元编程实战 code #include <iostream> // 编译器分支与多种返回类型 写法1 template <bool Check, std::enable_if_t<Check> * = nullptr> auto fun(){ r 阅读全文
posted @ 2021-01-25 15:17 HDU李少帅 阅读(90) 评论(0) 推荐(0)