原创 COM本質論——COM是一個好的C++

1.1 軟件的分發和C++         把C++作爲組件的基礎底層結構所帶來的問題:以前,C++一直以分發源代碼的形式來發布庫,這樣做是可行的,但存在問題:如果多個程序都使用一個代碼庫,則各個程序都將在自己程序中編譯同樣的代碼,並生

原创 hash_map 使用

今天在使用STL中的hash_map模板遇到使用PTCHAR作爲Key時無法對字符串進行正確比較的問題,在網上查找相應的文章可惜沒有找到,但找到了http://www.stlchina.org/twiki/bin/view.pl/Main

原创 Path Sum II

Path Sum IIOct 14 '123844 / 10801 Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equ

原创 Binary Tree Level Order Traversal II

Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order traversal of its nodes' va

原创 Convert Sorted List to Binary Search Tree

Convert Sorted List to Binary Search TreeOct 3 '123397 / 9589 Given a singly linked list where elements are sorted in

原创 Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binar

原创 Distinct Subsequences

Distinct SubsequencesOct 19 '123689 / 10619 Given a string S and a string T, count the number of distinct subsequence

原创 Minimum Depth of Binary Tree

Minimum Depth of Binary TreeOct 10 '124568 / 11410 Given a binary tree, find its minimum depth. The minimum depth is t

原创 二維指針

void func1(int **p){ } void func2(int *p[10]){ } void func3(int p[10][10]){ }void func1(int (*p)[10]){}void func1(int *

原创 DLL中傳遞STL參數

DLL中傳遞STL參數,vector對象作爲dll參數傳遞等問題(轉)   STL跨平臺調用會出現很多異常,你可以試試. STL使用模板生成,當我們使用模板的時候,每一個EXE,和DLL都在編譯器產生了自己的代碼,導致模板所使用的靜態

原创 Flatten Binary Tree to Linked List

Flatten Binary Tree to Linked List   Oct 14 '124412 / 13068 Given a binary tree, flatten it to a linked list in-place.

原创 opencv 開啓gpu模塊

1、OpenCV提供的開發包中提供的庫沒有開啓gpu和ocl模塊功能,雖然有***gpu.lib/***gpu.dll文件,但不能用。如果調用gpu::getCudaEnableDeviceCount()將會return 0;要開啓該功能

原创 Populating Next Right Pointers in Each Node

Given a binary tree struct TreeLinkNode { TreeLinkNode *left;

原创 static_cast、dynamic_cast、reinterpret_cast、和const_cast

關於強制類型轉換的問題,很多書都討論過,寫的最詳細的是C++ 之父的《C++ 的設計和演化》。最好的解決方法就是不要使用C風格的強制類型轉換,而是使用標準C++的類型轉換符:static_cast, dynamic_cast。標準C++中

原创 Populating Next Right Pointers in Each Node II

Populating Next Right Pointers in Each Node IIOct 28 '123191 / 7859 Follow up for problem "Populating Next Right Poin