摘要: 6.2 参数传递 含有可变形参的函数 如果实参类型相同,可以传递一个名为initializer_list 的标准库类型 #include <initializer_list> void error_msg(initializer_list<string> il){ for ( auto beg = 阅读全文
posted @ 2021-04-24 11:07 汉森伯逸 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 10.1 概述 10.2 初识泛型算法 1. 只读算法 int sum = accumulate(vec.cbegin(), vec.cend(), 0); accumulate 的第三个参数的类型决定了函数中使用哪个加法运算符以及返回值的类型 算法和元素类型 string sum = accumu 阅读全文
posted @ 2021-04-24 11:05 汉森伯逸 阅读(54) 评论(0) 推荐(0) 编辑
摘要: chapter2 空间配置器 2.2 具备次配置力的SGI空间配置器 以下代码都在<stl_alloc.h>中 SGI_STL使用两级配置器: 如果申请内存>128bytes,将使用__malloc_alloc_template 如果申请内存<=128bytes, 将使用__default_allo 阅读全文
posted @ 2021-04-24 11:02 汉森伯逸 阅读(65) 评论(0) 推荐(0) 编辑
摘要: chapter3 迭代器概念与traits编程技法 3.1 迭代器设计思维——STL关键所在 利用特性萃取机traits取得迭代器底层指针指向的类型,这是C++偏特化的经典应用 // included SGI_STL <stl_iterator.h> template <class Iterator 阅读全文
posted @ 2021-04-24 11:01 汉森伯逸 阅读(72) 评论(0) 推荐(0) 编辑
摘要: chapter4 序列式容器 vector /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and 阅读全文
posted @ 2021-04-24 10:59 汉森伯逸 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 一个C++实现的服务器脚手架,代码整洁 https://gitee.com/hsby/Xscaffold 赶紧fork! 工程由2021年1月开始,中间准备实习面试搁置了,4月加急持续更新中 阅读全文
posted @ 2021-04-24 03:14 汉森伯逸 阅读(356) 评论(0) 推荐(0) 编辑