原创 string replace C version

char *strrepl(char *dst, size_t dst_size, char *src, char *oldstr, char *newstr) {     int idx = 0;     int oldlen = st

原创 Simple multi-thread worker

class Worker { public: Worker(vector<int> &vec, int size):_vec(vec), _size(size) { } void operator ()() { while(

原创 Break the infinity thread loop using boost::this_thread::interruption_point()

// stop_while_thread.cpp : // #include "stdafx.h" #include <boost/thread.hpp> #include <iostream> using namespace std;

原创 Install boost on Windows for Visual C++

1)Download install from boostpro and install it (correct version and select header files)   2)Add include path Properti

原创 popular container with stringstream

        istringstream iss("3 2 1 4");         list<int> L1((istream_iterator<int>(iss)), istream_iterator<int>());

原创 VM_COPYDATA

VM_COPYDATA /*******************************************************/ //sender: /**************************************

原创 爲什麼要用 enable_shared_from_this ?

http://www.btsmth.com/show_snapshot.php?en_name=CPlusPlus&gid=314844   [合集] 請問boost中的enable_shared_from_this類問題 http://

原创 Create Ocx control CLIENT Application step by step (VS 2008)

Create Ocx control CLIENT Application   1) Add class   2)add class from MFC ActiveX   3)select target ocx       4)

原创 Perl common usage

#!/usr/bin/perl -w use strict; if ("helloworld" =~ / world/) {     print "match" } else {     print "bad." } print "/n"

原创 Technical questions

Base-derived class init sequence (member variable and constructor body)    class MemA { public: MemA(){ cout << "Me

原创 HeapSort implementation (Introduction to Algorithms)

// push down heap element data[index] in data[0..end] // array index start with 0 instead of 1 in CLR void max_heapify

原创 [轉貼] 使用PostThreadMessage (Using CWinThread)

.h 文件 #define WM_TEST    WM_USER + 1 class CTestThread : public CWinThread {     DECLARE_DYNCREATE(CTestThread) protec

原创 [轉貼]使用PostThreadMessage在Win32線程間傳遞消息

http://www.cppblog.com/sandy/archive/2009/05/22/2320.html   PostThreadMessage 的原型是這樣的 BOOL PostThreadMessage( DWORD idT

原创 Effective C++ v3 summaries

  C++ storage-class specifiers auto: default register: stored in machines registers static: stored in global stat

原创 Create Ocx control step by step (VS 2008)

Create Ocx control   1) add function     2) add event   3) function implementation   4) verified in OLE/COM viewer