unordered-set

    0熱度

    1回答

    我知道防止重複的好方法是使用unordered_set。但是,當我想要一個unordered_set<vector<string>>時,此方法似乎不起作用。我怎麼能這樣做呢?例如,我想阻止<"a", "b", "c">在我的unordered_set<vector<string>>中被複制。 這個unordered_set<vector<string>>可以在定義的類之外使用嗎? 代碼: unor

    0熱度

    2回答

    我想問一下在插入元素之前是否有任何檢查元素是否存在於unorderd_set中?根據documentation: 每個元件被插入,只有當它是不等同於在容器已任何其它元素(在unordered_set元素具有唯一值)。 所以,如果我正確地得到它在我的情況: Element *element = new Element; //... if (my_set.find (element) == my_

    2熱度

    3回答

    我知道人們在使用unordered_set的時候並不關心集合中元素的順序。然而,當我在C++ Shell #include <iostream> #include <unordered_set> #include <string> int main() { std::unordered_set<std::string> inputSet; inputSet.insert("Hell

    1熱度

    2回答

    我的問題不在於使用不區分大小寫的std :: unordered_set,而是它如何工作? #include "stdafx.h" #include <string> #include <iostream> #include <unordered_set> #include "boost/algorithm/string.hpp" struct case_insensitive_co

    2熱度

    1回答

    我想要做的是使我可以使用std :: unordered_set與我自定義類Vector2 - 包括可能性搜索已經在集合中的這種類的對象。 讓我來提供更多細節。我的課Vector2,包括自定義哈希表的標題,如下: Class Vector2 { private: static int lastID; const int id; int x; int y;

    0熱度

    1回答

    我的代碼看起來像這樣: class Node : public bitset<BITS_COUNT> { public: Node(string s) : bitset<BITS_COUNT>(s) {} void setGroup(unordered_set<Node>* newSet) { currentGroup = newSet; } unordered_s

    -3熱度

    1回答

    什麼是find方法在unordered_set<int>的時間複雜度的複雜性? 也有可能改變散列函數嗎?

    1熱度

    1回答

    我試圖插入一個Movie對象到unordered_set<Movie>容器,但我得到一個錯誤,說沒有這樣的匹配成員函數。我做了這樣的事情 void ActorGraph::addActor(string actor_name, string movie_title, int movie_year){ unordered_map<string, unordered_set<ActorNod

    2熱度

    2回答

    正如標題所說,我試圖使用包含Foo類對象的unordered_set作爲Foo類的數據成員。這在C++中可能嗎? 我有這樣的代碼: #include <unordered_set> using namespace std; struct FooHash; class Foo { public: int id; unordered_set<Foo, FooHash>

    0熱度

    1回答

    我在C++上有一個代碼,我必須在PHP上重寫。 奇怪的事情發生在我身上,因爲我是PHP程序員,不太瞭解C++。 這是代碼:代碼 #include <iostream> #include <unordered_set> using namespace std; int func(int choice) { unordered_set<int> hset; for (in