动态链接库和静态链接库

摘要: 三篇介绍动态链接库和静态链接库的博文:http://blog.csdn.net/gamecreating/article/details/5504152http://blog.csdn.net/firefoxbug/article/details/7326465http://www.cnblogs.... 阅读全文
posted @ 2015-04-13 21:15 Ryan-Xing 阅读(120) 评论(0) 推荐(0) 编辑

C++动态内存管理之shared_ptr、unique_ptr

摘要: C++中的动态内存管理是通过new和delete两个操作符来完成的。new操作符,为对象分配内存并调用对象所属类的构造函数,返回一个指向该对象的指针。delete调用时,销毁对象,并释放对象所在的内存。但在程序中使用new和delete容易导致很多问题,这里列出三个比较容易犯的错误。我们new了一个... 阅读全文
posted @ 2015-04-10 12:30 Ryan-Xing 阅读(963) 评论(0) 推荐(0) 编辑

Semaphore built from mutex in C++11

摘要: #include #include using namespace std;class semaphore{private: mutex mtx; condition_variable cv; int count;public: semaphore(int count_ = ... 阅读全文
posted @ 2015-03-04 12:46 Ryan-Xing 阅读(179) 评论(0) 推荐(0) 编辑

Visual Studio中的/MD, /MT, /MDd, /MTd 选项

摘要: Visual Studio中/MD, /MT, /MDd, /MTd表示多线程模块是否为dll。对于这几个选项我的理解如下:/MD: 定义了_MT和_DLL,让程序用多线程和dll版本的运行库。/MT: 让程序用多线程和静态版本的运行库。/MDd: 定义了_MT、_DLL、_DEBUG,让程序用de... 阅读全文
posted @ 2015-02-05 20:36 Ryan-Xing 阅读(771) 评论(0) 推荐(0) 编辑

Leetcode:Maximum Subarray

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2015-01-15 21:46 Ryan-Xing 阅读(104) 评论(0) 推荐(0) 编辑

Leetcode:Container With Most Water

摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2015-01-15 16:43 Ryan-Xing 阅读(179) 评论(0) 推荐(0) 编辑

Leetcode:Best Time to Buy and Sell Stock II

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文
posted @ 2015-01-15 11:57 Ryan-Xing 阅读(98) 评论(0) 推荐(0) 编辑

Leetcode:Best Time to Buy and Sell Stock

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2015-01-15 11:39 Ryan-Xing 阅读(99) 评论(0) 推荐(0) 编辑

Leetcode:Jump Game II

摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-01-15 11:28 Ryan-Xing 阅读(83) 评论(0) 推荐(0) 编辑

Leetcode:Pow(x, n)

摘要: Implement pow(x,n).分析:分治法。代码如下:class Solution {public: double pow(double x, int n) { if(n < 0) return 1.0/power(x, -n); return power(... 阅读全文
posted @ 2015-01-14 21:45 Ryan-Xing 阅读(109) 评论(0) 推荐(0) 编辑