随笔分类 -  C++

摘要:正好在实现一个Vector2类型: template<typename T> struct Vector2; template<typename T> Vector2<T> operator+(const Vector2<T>& v1, const Vector2<T>& v2); template 阅读全文
posted @ 2021-04-21 10:30 威化饼干 阅读(8) 评论(0) 推荐(0)
摘要:虚析构函数是可以声明的,这意味着需要由于子类来实现接口的析构函数。 reference: https://blog.csdn.net/wufeifan_learner/article/details/88804072 class A{ public: A(){ cout<<"构造函数A"<<endl 阅读全文
posted @ 2021-03-24 23:56 威化饼干 阅读(6) 评论(0) 推荐(0)
摘要:template < typename TO, typename FROM > inline TO union_cast( FROM value ) { union { FROM from; TO to; } convert; convert.from = value; return convert 阅读全文
posted @ 2021-02-02 18:23 威化饼干 阅读(255) 评论(0) 推荐(0)
摘要:Link to StackOverflow: Why does the C++ map type argument require an empty constructor when using [] by Nick Bolton? Q: Not a major issue, just annoyi 阅读全文
posted @ 2019-07-12 09:57 威化饼干 阅读(135) 评论(0) 推荐(0)
摘要:If only member function _clear_ of _WindowMgr_ is a friend of _Screen_, there are some points need to note. Sequence is important. First, define the _ 阅读全文
posted @ 2019-01-18 15:21 威化饼干 阅读(143) 评论(0) 推荐(0)
摘要:About why inline member function should defined in the header file. It is legal to specify inline on both the declaration and the definition. But the 阅读全文
posted @ 2019-01-18 15:13 威化饼干 阅读(104) 评论(0) 推荐(0)