鍍金池/ 問答/ C++問答
浪蕩不羈 回答

初步來看是真的是sublime引起的,因為安裝了一些自動補全,自動提示的包,在寫代碼的時候sub會調(diào)用python來為我們最一些補全和差錯

又因為我代碼卡死是經(jīng)常容易發(fā)生的事情,又不知道卡死的是哪一個pytohn,故使用命令結(jié)束所有的python進程,這就導致本來運行在sublime里的python進程遭到殺死,sublime檢測到后,會自動重啟python進程,造成了我感覺python殺不死的假象

不過sublime表面小巧,啟動快速,占內(nèi)存小,但就我目前的配置來說,這樣(可能由插件引起)的占cpu還是比較高的,電腦是i7 7700,占了有30%到40%差不多,不殺進程,用sublime倒是一點都不卡,主要是寫的程序一般為cpu密集型的,sub占我cpu我是不太高興,現(xiàn)在采取的做法是一段時間重啟下sublime可以解決大部分問題

以上

賤人曾 回答

不用這些之前,前端界的界面組件很多是基于jQuery實現(xiàn)的,當然還有一些自成一體的ui組件不依賴jQuery或使用其他一些框架,但基于jQuery的組件最為豐富。

兮顏 回答

去掉鏈接參數(shù),在代碼中加入#pragma comment(lib,"xxx.lib").
你把xxx.lib加入到你項目的目錄下再調(diào)試。

尋仙 回答

兩天才通過審核……,自己找到了解決方法,之前剛開始學習qt,使用多線程就可以解決了。

執(zhí)念 回答
let root = [{
  id: '1',
  name: '姓名1',
  items: [
    {
      id: '2',
      name: '姓名2',
      items: [
        {
          id: '3',
          name: '姓名3',
          items: [
            {
              id: '4',
              name: '姓名4',
            },
          ],
        },
      ],
    },
    {
      id: '5',
      name: '姓名5',
    },
    {
      id: '6',
      name: '姓名6',
    },
  ],
}];

function search(root, id) {
  for (let i = 0; i < root.length; i += 1) {
    if (root[i].id === id) {
      return [{ id, name: root[i].name }];
    }
  }
  for (let i = 0; i < root.length; i += 1) {
    if (root[i].items && Array.isArray(root[i].items)) {
      const res = search(root[i].items, id);
      if (res.length) return [...res, { id: root[i].id, name: root[i].name }];
    }
  }
}

console.log(search(root, '5'));
console.log(search(root, '3'));
短嘆 回答

注意在insert()中, last是有++操作的, 所以你在用這個順序表插入的時候last會自己更新.

且在初始化時令last=-1,表示初始化為一個空表(我的理解是只有一個元素,表中最后位置就是0,所以-1就表示一個空表,應該是這樣吧)

last = -1只是說明里面沒有元素. 這是在構(gòu)造函數(shù)里完成的.

至于你在find()里提到的疑惑, 是因為你肯定先要insert(), 再find(), 這時last已經(jīng)不是-1了, 因為合法的insert()過了.

PS: 不過這本書的碼風很糟糕, 窩覺得或許你該找好一點的材料學習(不過講道理, 數(shù)據(jù)結(jié)構(gòu)/算法的書基本碼風都一塌糊涂...至少國外的書是這樣(除了clrs這樣用偽碼的), 國內(nèi)不清楚.

淚染裳 回答

data中聲明變量不是應該在return中嗎?
獲取后臺數(shù)據(jù)應該在mounted 調(diào)用 ,
個人感覺,這個代碼結(jié)構(gòu)有點混亂

methods:{
    addPage(){
    this.page++;
    this.xxx()
    }
} 

page ++后,再次調(diào)用那個依賴page參數(shù)的方法

你的瞳 回答

二次分享時,微信會自動在url后加上from=singlemessage&isappinstalled=0
在連接后加上your url?&from=singlemessage&isappinstalled=0再進行分享,即可分享成功

夏木 回答

這些數(shù)字并不是代碼,是類似 R.id.xxx,R.layout.xxx 之類的,本身就是 int 值,代表資源id

夏夕 回答

感謝 @felix 指教,為了清晰起見,我自答一下:

  1. 這個行為是 C++ 標準的,還是 g++ 特有的?

    這種行為是 C++ 標準的。參考:

    http://zh.cppreference.com/w/...

    之中【內(nèi)建的成員訪問運算符】,第四種用法:

    expr -> pseudo-destructor

    expr 是一個標量類型,pseudo-destructor 為一個 ~ 之后跟著代表與 expr 相同類型的類型名,所構(gòu)成的函數(shù)調(diào)用表達式被稱為偽析構(gòu)函數(shù)調(diào)用。它不接受任何參數(shù),返回 void,且除了對開頭的 expr 求值之外不實施任何操作。允許進行偽析構(gòu)函數(shù)調(diào)用,使得編寫代碼而無需了解某個給定類型是否存在析構(gòu)函數(shù)成為可能。

    上面敘述中的類型名(type name)對當前語法來說,可以指 typedef 或者 using(type alias)聲明的名字,而不指類型本身。舉例說明:

    int main() {
        typedef int Int;
        int* p = new int(10);
        p->~Int(); // ok, do nothing
        // p->~int(); error: expected identifier before ‘int’
        return 0;
    }
  2. 應該怎樣闡述 data_->~T() 的行為?

    當 T 是標量類型(可有 cv 限定的算術(shù)、指針、指向成員指針、枚舉或 std::nullptr_t 類型)時,它表示偽析構(gòu)函數(shù)調(diào)用,即除了對 data_ 取值不做任何事。

    當 T 不是標量類型時,它顯式調(diào)用了 data_ 的析構(gòu)函數(shù)。

這種行為讓 data_->~T() 的調(diào)用變得很理想。

有點壞 回答

js
data() {return {content: '<a href="xxx">點擊進入</a> <span>Hello 你好</span>'}}`
模板
<div>{{content}}</div>

笨笨噠 回答

C++中不建議使用裸指針,最好使用shared_ptr或者unique_ptr

懶豬 回答

Remarks

The color format of the bitmap created by the CreateCompatibleBitmap function matches the color format of the device identified by the hdc parameter. This bitmap can be selected into any memory device context that is compatible with the original device.
Because memory device contexts allow both color and monochrome bitmaps, the format of the bitmap returned by the CreateCompatibleBitmap function differs when the specified device context is a memory device context. However, a compatible bitmap that was created for a nonmemory device context always possesses the same color format and uses the same color palette as the specified device context.
Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap. To create a color bitmap, use the HDC that was used to create the memory device context

MSDN 里說了CreateCompatibleBitmap創(chuàng)建的是monochrome(單色的)

傲寒 回答
  1. 模板盡量還是不要分離寫
  2. 針對你的問題,其中最簡單的解決辦法是main.cpp里面#include"TemplateArray.cpp"
  3. 或者把全部的實現(xiàn)都放在TemplateArray.hpp
浪蕩不羈 回答

我覺得要對照上下文來看吧。

只看你貼出來的片段,意思是不是說子程序不能(或者是不應該)依賴于它之前的執(zhí)行過程,而只是忠實地執(zhí)行調(diào)用方讓他做的工作。做完之后,要負責把自己的工作現(xiàn)場清理干凈?

比如說,對于子程序,就是每次執(zhí)行的時候都會在系統(tǒng)中殘留文件、殘留句柄、殘留堆棧等等,并且下次被調(diào)用的時候,還會讀取這些殘留信息,并且影響下次執(zhí)行效果?

款爺 回答
必須反駁 “循環(huán)是不行的”
function s(){
    let n = res;
    let r = [...n];
    do{
        let N_r = [];
        for(let node of r){
            delete(node["code"]);
            if(node.children){
                N_r = N_r.concat(node.children);
            }
        }
        r = N_r;
    }while(r.length);
    return n; 
}
朕略傻 回答

使用mysql_use_result()時,必須執(zhí)行mysql_fetch_row(),直至返回NULL值,否則,未獲取的行將作為下一個檢索的一部分返回。
https://baike.baidu.com/item/...