上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页
摘要: 1 隐性性能开销 1.1 STL容器的clear的时间复杂度不是O(1) 很多人潜意识认为STL容器中clear()成员函数的时间复杂度为常量时间复杂度O(1)。原因是大家觉得对于vector而言,clear()之后,修改了size()的结果,不影响capacity()的结果,因而得出clear() 阅读全文
posted @ 2021-11-16 14:08 钟齐峰 阅读(580) 评论(0) 推荐(0) 编辑
摘要: 1、静态库libtools.a源码 libtools.h #ifndef tools_h_ #define tools_h_ int sub(int x,int y); int mul(int x,int y); #endif libtools.cpp #include"libtools.h" in 阅读全文
posted @ 2021-10-09 15:37 钟齐峰 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 环境:centos 7.9 1、准备环境 sudo yum install docker sudo systemctl start docker.service sudo docker pull trzeci/emscripten:latest 2、编写C++源文件 //main.cpp #incl 阅读全文
posted @ 2021-09-10 13:42 钟齐峰 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 环境:centos 7 1、准备开发环境 $ yum groupinstall "Development Tools" $ yum install glibc-static libstdc++-static 2、下载源码 wget http://ftp.gnu.org/gnu/gcc/gcc-11. 阅读全文
posted @ 2021-08-31 09:52 钟齐峰 阅读(586) 评论(0) 推荐(0) 编辑
摘要: 1、下载文件下载地址:https://mirrors.tuna.tsinghua.edu.cn/gnu/glibc/glibc-2.18.tar.gz 2、安装部署解压tar -zxvf glibc-2.18.tar.gz 创建编译目录cd glibc-2.18 mkdir build 编译、安装c 阅读全文
posted @ 2021-08-30 13:00 钟齐峰 阅读(784) 评论(0) 推荐(1) 编辑
摘要: Environment:Ubuntu 16.06 + emscripten URL: https://emscripten.org/docs/getting_started/downloads.html#linux 1. Installation emsdk # Get the emsdk repo 阅读全文
posted @ 2021-08-27 09:44 钟齐峰 阅读(462) 评论(0) 推荐(0) 编辑
摘要: 1、栈和队列 栈和队列都是以deque为底层容器的适配器。栈(stack)、队列(queue)、优先队列(priority_queue)这三种数据结构,准确的来说其实是一种适配器,因为底层都是以其他容器为基准。 栈:先入后出,只允许在栈顶添加和删除元素,称为入栈和出栈。 队列:先入先出,载队首取元素 阅读全文
posted @ 2021-08-14 20:38 钟齐峰 阅读(163) 评论(0) 推荐(0) 编辑
摘要: if (__cplusplus > 201703L) std::cout << "C++2a\n"; else if (__cplusplus == 201703L) std::cout << "C++17\n"; else if (__cplusplus == 201402L) std::cout 阅读全文
posted @ 2021-08-13 14:34 钟齐峰 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 1、简介 双端队列deque,与vector的最大差异在于: 一、deque运行常数时间对头端或尾端进行元素的插入和删除操作。 二、deque没有所谓的容器概念,因为它是动态地以分段连续空间组合而成随时可以增加一块新的内存空间并拼接起来。 虽然deque也提供随机访问的迭代器,但它的迭代器与list 阅读全文
posted @ 2021-08-08 16:44 钟齐峰 阅读(3437) 评论(0) 推荐(0) 编辑
摘要: 测试环境:windows10 + gcc8.1 1、constexpr产生背景 c++11以后,为了保证写出的代码比以往任何时候的执行效率都要好而进行了许多改善。其中,这种改善之一就是生成常量表达式,允许程序利用编译时的计算能力。常量表达式主要是允许一些计算发生在编译时期,而不是运行时期。这是一个很 阅读全文
posted @ 2021-08-04 15:52 钟齐峰 阅读(2256) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页