【无标题】

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;
}

image-20220327170831780

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值