c++
文章平均质量分 55
don.wang
这个作者很懒,什么都没留下…
展开
-
C++最小堆
#include <iostream> class MinHeap { private: int _max; int _count; int *_ptr; public: explicit MinHeap(int number) { _max = number; _count = 0; _ptr = new int(_max); } ~MinHeap() { if.原创 2022-04-19 15:40:06 · 819 阅读 · 0 评论 -
WPF printf 到控制台
### 1、重定向输出到控制台 void InitConsoleWindow() { if (!AllocConsole() || !freopen("CONOUT$", "w", stdout)) AfxMessageBox(_T("InitConsoleWindow Failed!")); //分配控制台在重定向输出流至控制台 } ### 2、启动 在程序入口加入 #ifd...原创 2019-10-28 18:01:47 · 404 阅读 · 0 评论 -
c++11 unique_ptr && shared_ptr
#include <array> #include <cassert> #include <chrono> #include <fstream> #include <iostream> #include <memory> #include <mutex> #include <thread&g原创 2019-01-04 11:19:38 · 172 阅读 · 0 评论 -
c++11 async
#include <chrono> #include <future> #include <iostream> #include <string> #include <thread> std::string fetchDataFromDB(std::string recvData) { std::this_thread::sl...原创 2019-01-04 11:41:56 · 270 阅读 · 0 评论 -
c++11 condition_variable && future
条件变量std::condition_variable用于多线程之间的通信,它可以阻塞一个或同时阻塞多个线程。std::condition_variable需要与std::unique_lock配合使用 #include <condition_variable> #include <iostream> #include <mutex> #include &...原创 2019-01-04 11:51:18 · 507 阅读 · 0 评论 -
c++11 template factory
自动注册工厂CSDN里已经有人解析过了,这里是学习过程中的总结、并详细解析。话不多说,先看代码: oly_auto_factory.h #pragma once #include <functional> #include <map> #include <memory> #include <string> namespace oly { /*...原创 2019-01-08 14:54:15 · 543 阅读 · 0 评论 -
c++ 虚函数表解析
原文链接:https://blog.csdn.net/hairetz/article/details/4137000 C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让父类的指针有“多种形态”,这是一种泛型技术。所谓泛型技术,说白了就是试图使用不变的代码来实现可变的算法。比如:模板技术,R...转载 2019-03-02 10:32:42 · 81 阅读 · 0 评论