
C++ STL 学习笔记
garrulousabyss
Github: https://github.com/Gogogoforit
展开
-
黑马程序员2017C++STL教程(1到4)
一. 函数模板基本语法#include <iostream>using namespace std;template<class T>void MySwap(T& a, T& b){ T temp = a; a = b; b = temp;}//注意对于一个template而言,只能将其用于,紧贴它的那一个函数,二对...原创 2018-04-22 06:37:44 · 3128 阅读 · 0 评论 -
黑马程序员2017C++STL教程(5到8)
五. 模板函数实现原理剖析六. 类模板基本语法#include <iostream>using namespace std;template<class T>class Person{public: Person(T id ,T age){ this->mId = id; this->mAge = age; ...原创 2018-04-29 07:15:19 · 901 阅读 · 0 评论 -
黑马程序员2017C++STL教程(9到11)
九. 普通类的 .h 和 .cpp分离编写模式首先是 person.h#include <iostream>#include "person.h"using namespace std;int main(){ Person p("AAA",20); p.Show(); return 0;}然后是person.cpp#include "person....原创 2018-05-08 00:04:11 · 1348 阅读 · 0 评论 -
《C++ STL编程实战》读书笔记(一)
一.//Ex1_01//using iterators//2019年9月28日15:53:10#include <numeric>#include <iostream>#include <iterator>using namespace std;int main(){ double data [] = {2.5,4.5,6.5...原创 2019-09-28 16:30:53 · 359 阅读 · 0 评论 -
c++ 知识点 std::function 使用
这是c++11新添加的,头文件#include <functional>官方说明:Class templatestd::functionis a general-purpose polymorphic function wrapper. Instances ofstd::functioncan store, copy, and invoke anyCallabl...转载 2019-09-28 16:21:29 · 1257 阅读 · 0 评论 -
《C++ STL编程实战》读书笔记(二)
// Ex2_01.cpp//2019年9月28日17:11:02/*Using array<T,N> to create a Body Mass Index (BMI) tableBMI = weight/(height*height)weight is in kilograms, height is in meters*/#include <iostream...原创 2019-09-28 22:19:48 · 262 阅读 · 0 评论 -
《C++ STL编程实战》读书笔记(三)
容器适配器是一个封装了序列容器的模板(1)stack<T>是一个封装了deque<T>容器的适配器模板(2)queue<T>是一个封装了deque<T>容器的适配器模板(3)priority_queue<T>是一个封装了vector<T>容器的适配器模板//ex3_01//2019年9月30日16:50:2...原创 2019-09-29 00:04:06 · 408 阅读 · 0 评论 -
《C++ STL编程实战》读书笔记(四)
map容器的介绍:1. 关联容器的概念2. map容器的概念及它的组织方式3. map容器的类型及其功能4. map容器提供的函数5. pair的概念及其用法6. tuple的概念及其用法map的容器有4种,每一种都是由类模板定义的。map容器的元素是pair<const& K,T>类型的对象,这种对象分装了一个T类型的对象,和一个与其关...原创 2019-09-30 22:48:59 · 383 阅读 · 0 评论