C++ STL标准模板库
胸中自有丘壑。
C++标准库 vs C++ 标准模板库
-
C++标准库 包含了 C++ STL标准模板库
-
标准库以header files形式呈现。
C++ 标准库header files 不带副档名(.h)例如 #include
新式C header files 不带副档名(.h),例如 #include
旧式C header files 带副档名(.h),例如 #include<stdio.h>
-
新式headers内部组件封装于namespace “std”
using namespace std; or
using std::cout;
-
旧式headers内的组件不封装于namespace “std”
常见的网站和书籍
网站
www.cplusplus.com
www.cppreference.com
https://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/a00464.html
书籍
STL源码剖析 侯捷
Test-STL.cpp
STL 6大部件
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int ia[6] = {27, 210, 12, 47, 109, 83};
vector<int, allocator<int>> vi(ia, ia + 6);
cout << count_if(vi.begin(), vi.end(), not1(bind2nd(less<int>(), 40)));
return 0;
}