erase

    2熱度

    2回答

    我有這樣的代碼: #include <cstdlib> #include <map> #include <string> #include <iostream> #include <algorithm> #include <stdint.h> class Table { public: std::map<uint32_t, std::string> m_map;

    -1熱度

    1回答

    #include <iostream> #include <vector> #include <cstdlib> #include <time.h> using namespace std; void makeVector(); void breakVector(); vector<char> asciiChar; vector<char> shuffledChar; i

    0熱度

    2回答

    因爲我們可以在std :: string中使用string.erase函數來刪除特定範圍的字符,所以我可以使用任何函數刪除這些字符。 對於如: std::string string = "This is a test". 我可以用 string.erase(2,(string.length())); 是否有任何CString類似的方法? 謝謝。

    0熱度

    1回答

    我想在窗口大小調整時重繪畫布。 當窗口調整大小時,畫布不會重繪藍色矩形,也不會顯示擦除效果。 我是新來的畫布,我無法弄清楚這一點。 我該如何解決這個問題? var canvas = document.getElementById("canvasTop"); // set the canvas element's width/height to cover #wrapper var wr

    3熱度

    3回答

    這對我和其他人都是一個學習問題。我的問題是有一個指向矢量內容的指針。當我擦除矢量的第一個元素時,會發生該問題。我不太清楚我期待的是什麼,我以某種方式假定,當刪除項目時,向量不會開始移動內存中的對象。 我的問題是:有沒有辦法將對象保留在內存中?例如更改矢量的底層容器?以我的特殊例子來說,我將刪除指針訪問權限,並僅僅使用和id作爲對象,因爲類無論如何都需要一個ID。 這裏是一個簡單的例子: #incl

    -1熱度

    2回答

    我對C++中的std::erase函數感到困惑。 以下代碼在調用std::erase之前和之後獲得相同的輸出。但是,如果在執行std::erase後遍歷列表,則輸出中未顯示擦除值。 幫我理解std::erase。 #include<bits/stdc++.h> using namespace std; int main() { list<int> v; v.push_b

    -1熱度

    2回答

    我知道這個標題很混亂,我只是用這麼幾個字來描述它。 考慮以下代碼: #include <vector> #include <string> using std::string; using std::vector; int main() { vector<string> s = { "foo", "bar", "random_word" }; vector<int>

    -1熱度

    1回答

    編輯:這個問題是指專門爲std ::名單 - 堆棧溢出其他類似的問題涉及到std ::向量 我使用C++和遇到問題從一個std刪除元素::列表,而迭代它。我有一個自定義類(「對象」這一問題的緣故),列表和我的代碼如下所示: for(auto i : Objects) if(i.EraseFlag == true) { i = Objects.erase(i);

    0熱度

    1回答

    我必須由索引從一個「組」刪除「成員」的問題: #include <vector> #include <string> using namespace std; class Member { public: explicit Member(const string &name, const unsigned long &key) : m_name(name), m_ke

    -4熱度

    1回答

    所以我開始學習載體,我想從一個結構向量擦除元素,我有這樣的結構: typedef struct Carro{ int id, cc, cv; char marca[50], modelo[50]; }car; typedef struct Condutor{ vector<car> cars; int id; int totalC=0;