
C++基础总结
C++基础知识总结
枸杞养生
这个作者很懒,什么都没留下…
展开
-
文章记录
QT:动态库的制作以及调用:https://blog.youkuaiyun.com/qq_34837137/article/details/52277447原创 2020-08-09 23:43:19 · 198 阅读 · 0 评论 -
C++ 11 可变模板参数 variadic template
template<typename T,typename... Type> void Print(const T& firstArg,const Types&... args) { cout<<firstArg<<endl; Print(args...); } //最后一次使用 void Print() { } //siz...原创 2020-02-23 19:41:50 · 167 阅读 · 0 评论 -
C++ 模板模板参数template template parameter
template <typename T, template <typename T> class Container > class XCls { private: Container<T> c; } // 第二个模板参数类型是第一个参数的类型 ...原创 2020-02-23 18:20:21 · 301 阅读 · 0 评论 -
C++模板特化 specialization
特化是泛化的反面,针对特定的具体的设计的一种方法: //泛化 template <class Key> struct hash{}; //特化 template<> struct hash<char> { size_t operator()(char x)const {return x;} } template<> struct...原创 2020-02-23 18:04:19 · 165 阅读 · 0 评论 -
C++成员模板
//成员模板就是模板中包含模板 template <class T1,class T2> struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair() :first(T1()),second(T2()){} pair(co...原创 2020-02-23 17:43:48 · 130 阅读 · 0 评论 -
C++中函数模板
function template ,函数模板 template <class T> inline const T& min(const T& a,const T& b) { return b<a?b:a; } stone r1(2,3),r2(3,3); r3=min(r1,r2); class stone { public: ...原创 2020-02-23 17:18:09 · 79 阅读 · 0 评论 -
namespace 经验谈
使用namespace 包裹不同的文件 #include <iostream> #include<list> namespace jj01 { //开始设计 template<typename T> using Lst=list<T,allocator<T>>; void test() } ...原创 2020-02-23 16:10:25 · 138 阅读 · 0 评论 -
C++类 普通智能指针以及迭代器智能指针
tempate<class T> class shared_ptr { public: T& operator*()const {return *px;} T* operator->()const {return px;} shared_ptr(T* p):px(p) {} private: T* px; ...原创 2020-02-23 15:26:42 · 419 阅读 · 0 评论 -
C++模块与泛型编程
学习侯捷老师,C++模板与泛型编程总结 Conversion function 转化函数 class Fraction { public: Fraction(int num,int den=1) :m_numerator(num),m_denominator(den){} //转化函数可以加认为可以转化的所有函数,string .... operat...原创 2020-02-23 14:48:57 · 138 阅读 · 0 评论