原创 智能指針shared_ptr、weak_ptr、unique_ptr總結

在C++98中,智能指針通過模板類型"auto_ptr"來實現。這在一定程度上避免了忘記釋放內存造成的問題。不過auto_ptr有一些缺陷(拷貝時返回一個左值,不能調用delete[]等),因此,在C++11中,auto_ptr被廢棄了。

原创 Qt中的QString, int等數據轉換

Qt中 int ,float ,double轉換爲QString 有兩種方法 1.使用 QString::number(); 如: [cpp] long a = 63;   QString s = QStr

原创 Matlab除法結果取整

1)fix(x) : 截尾取整.>>fix(37/10) ans =      3(2)floor(x):不超過x 的最大整數.(高斯取整)>>floor(5.6) ans =      5(3)ceil(x) : 大於x 的最小整數>>

原创 C++ 多線程之臨界區

關於C++臨界區Critical Sections http://blog.sina.com.cn/s/blog_8eee7fb601012omv.html中將的很清楚了 在多線程中,我們看一下使用CRITICAL_SECTION和不使用

原创 c++ int 轉char * 函數 _itoa_s

_itoa_s 函數原型如下:  errno_t _itoa_s(    int value,    char *buffer,    size_t sizeInCharacters,  //存放結果的字符數組長度    in