????C++???й??к????г????????????????????C++??Java?????????顣????????????????????????????????????????澭?????????????Щ???????????????Щ???????????????
???????????????
????[1] ?麯?????????? ??i = 0; ++i++?????????????????????????????????????????????????????????????????????????C++??????????????????á???????????麯???????麯???????????????????????????????????????????????????????麯?????????????麯??????????????????????????Java????????????????
?????????????
????[1] (5??) C++???????main???????????main??????????Щ????
????[2] (5??) ??????C++?????????????singleton????????????????????singleton?????????????????socket????????connection??????????? ????????????????
????[3] (5??) ?????????????????????mutex?????????????mutex???з????????????????????????????unlock???????????????????
class MutexHelper
{
public:
MutexHelper(TLock& lock):iLock(lock) { pthread_mutex_lock(&iLock); }
~MutexHelper() { ptrhead_mutex_unlock(&iLock); }
}
//TODO: disable assignment and cctor
privae:
pthread_mutex_t& iLock;
};
class Worker
{
public:
Worker() { pthread_mutex_init(&iLock?? NULL); }
~Worker() { pthread_mutex_destroy(&iLock); }
public:
void FuncNeedSync();
private:
pthread_mutex_t iLock;
};
void Worker::FuncNeedSync()
{
MutexHelper helper(iLock);
//TODO: something;
}
????[4] (5??) ??????itoa?????????????????????????????????????????????????????????????????????????????????????????????????????????????
????[5] (4??) C++???static????????????????????????static??????????????????
????[6] (4??) ????????std::string rst?????????????????????????????????????????4k???????????????????????reserve??????????????+=??
????[7] (3??) ?????????Щ?????std::map??find??????????????????????????????????std::map????????????????????N???????find????????????κ???????????????????????????????????????????????????????е???????? ??????????????????????????google????