std::unordered_set::bucket_size std::unordered_set::bucket_size size_type bucket_size( size_type n ) const; (since C++11) 返回桶中带有索引的元素数。n... 参数 n - the index of the bucket to examine 返回值 桶中的元素数n... 复杂性 常量。 另见 bucket_count returns the ...
std::unordered_set满足容器(Container)、具分配器容器(AllocatorAwareContainer)、无序关联容器(UnorderedAssociativeContainer)的要求。 成员类型 成员类型定义 key_typeKey value_typeKey size_type无符号整数类型(通常是std::size_t) difference_type有符号整数类型(通常是std::ptrdiff_t) ...
unordered_set( size_type bucket_count, const Allocator& alloc ) : unordered_set(bucket_count, Hash(), key_equal(), alloc) {} unordered_set( size_type bucket_count, const Hash& hash, const Allocator& alloc ) : unordered_set(bucket_count, hash, key_equal(), alloc) {} (1) (C++14 ...
Key: Type of the elements. Each element in an unordered_set is also uniquely identified by this value. Aliased as member types unordered_set::key_type and unordered_set::value_type. Hash: A unary function object type that takes an object of the same type as the elements as argument and ...
#include <iostream> #include <locale> #include <unordered_set> int main() { std::unordered_set<char> p; std::unordered_set<long> q; std::cout.imbue(std::locale("en_US.UTF-8")); std::cout << std::uppercase << "p.max_size() = " << std::dec << p.max_size() << " ...
std::unordered_set<std::string> c{ "aaa", "bbb", "ccc" }:初始化容器,并将"aaa", "bbb", "ccc"加入到容器中; std::unordered_set<std::string> c{ 16 }:初始化容器,并设置16个桶; 2.2 添加新的元素 c.insert("dddd"):向容器添加元素”dddd"; ...
size_type bucket_count, const Hash& hash, const Allocator& alloc ) : unordered_set(first, last, bucket_count, hash, key_equal(), alloc) {} (8) (since C++14) unordered_set( const unordered_set& other ); (9) (since C++11) unordered_set( const unordered_set& other, const Allocat...
unordered_set::emplace unordered_set::emplace_hint Lookup unordered_set::count unordered_set::find unordered_set::contains (C++20) unordered_set::equal_range Bucket interface unordered_set::begin(size_type)unordered_set::cbegin(size_type) unordered_set::end(size_type)unordered_set::cend(size_ty...
>usingunordered_set=std::unordered_set<Key, Hash, Pred, std::pmr::polymorphic_allocator<Key>>; } (2)(since C++17) std::unordered_setis an associative container that contains a set of unique objects of typeKey. Search, insertion, and removal have average constant-time complexity. ...
std::swap(std::unordered_set) std::swap(std::vector) std::tuple_element<std::array> std::tuple_size(std::array) std::unordered_map std::unordered_map::at std::unordered_map::begin std::unordered_map::begin(int) std::unordered_map::bucket std::unordered_map::bucket_count std::unor...