C++
文章平均质量分 72
Cu2S
这个作者很懒,什么都没留下…
展开
-
使用 CPUID 查询 CPU 信息
cpuid 是用来查询 CPU 相关信息的指令。其大致使用方式为:在 eax(有时会涉及 ecx)放入指定的值使用 cpuid在指定寄存器中取值在 Visual C++ 以及 GCC 中,都有对应的 CPUID 的 intrin:#if defined(_MSC_VER)#include <intrin.h>#elif defined(__GNUC__)#include <cpuid.原创 2016-03-29 21:07:06 · 6014 阅读 · 0 评论 -
libc++ hashtable 源码简析
libc++ hashtable 源码简析本文分析的是 https://github.com/llvm-mirror/libcxx/ 中截止至 2016 年 1 月 30 日最新的 libc++。 libc++ 中, hashtable 的实现为链式结构。 在教科书中(Introduction To Algorithm 3rd Edition)中,介绍的实现是由一个数组作为buckets,每个数组原创 2016-01-31 22:55:34 · 1175 阅读 · 0 评论 -
GacUI源码简析(一)
GacUI源码简析(一) 本文中介绍的 GacUI 源代码来自于 https://github.com/vczh-libraries/GacUI。 在 GacUI 中,`WinMain` 开始后,第一个执行的函数为 `SetupWindowsDirect2DRenderer` :int SetupWindowsDirect2DRenderer(){ CoInitializeEx(NUL原创 2015-11-09 18:15:06 · 2367 阅读 · 0 评论 -
算法导论 10.4.5 O(1)空间遍历二叉树
#pragma once#include #include #include #include //templateclass binary_search_tree{public: using value_type = int; struct node { value_type value_; node* left_; node* right_; node*原创 2015-08-15 00:55:47 · 888 阅读 · 0 评论 -
Visual C++ 2015 下的 enable_shared_from_this 原理简析
一般来说,搞到一个shared_ptr有两种常见方式: + 使用构造函数,如: cpp std::shared_ptr<foo> ptr{new foo{}}; + 使用make_shared(allocate_shared),如: cpp auto ptr = std::make_shared<foo>(); 在Visual C++ 2015下,第二种方式也走的是原创 2015-07-28 22:42:50 · 1112 阅读 · 0 评论 -
libc++ tuple源码剖析
我们先来看这段代码:// __lazy_andtemplate <bool _Last, class ..._Preds>struct __lazy_and_impl;template <class ..._Preds>struct __lazy_and_impl<false, _Preds...> : false_type {};template <>struct __lazy_and_im原创 2015-06-10 17:35:21 · 1661 阅读 · 0 评论 -
POJ 3436 ACM Computer Factory
#include #include #include #include #include #include #include #include const int MaxCount = 64;struct Edge{ Edge(int _t, int _c, int _r) :to(_t),cap(_c),rev(_r) { } int to, cap, rev原创 2015-05-23 18:11:45 · 476 阅读 · 0 评论 -
二叉搜索树的详细实现
本代码实现了:插入删除非递归的中序遍历、前序遍历、后序遍历从前序遍历与中序遍历中恢复二叉树 本代码在 Clang 3.6 for Windows 与 Visual Studio 2015 CTP 6 下编译通过。头文件无警告。原创 2015-04-07 08:14:25 · 606 阅读 · 0 评论 -
Windows 7 Task Dialogs
自从 Windows 7 发布以来,不少应用的面貌都有了极大改变,使得应用程序与用户可以更好地交互。这得益于 Windows 7 新增的大量Win32 API。今天探讨的是 Task Dialogs。 在 Windows 7 中,增加了一种 Common Control,叫做 Task Dialog。这种 Dialog 在系统中随处可见,如下图中 IE 的对话框:这种 Task原创 2015-04-05 17:05:49 · 1733 阅读 · 0 评论 -
函数声明符的右值、左值引用以及const引用
有这么一段代码:原创 2014-08-06 23:32:10 · 923 阅读 · 0 评论 -
C++ 17 的最新动态
cpp17#本次会议确定的 C++ 17 特性:Core Lang: 1. [[fallthrough]] [[nodiscard]] [[maybe_unused]] P0068R0 2. constexpr Lambdas(允许一个 closure type 作为 literal type,对 lambda 的调用可以一个 constant expression(closure type 的原创 2016-03-05 12:18:58 · 1983 阅读 · 4 评论