public member function
<unordered_set>
std::unordered_set::unordered_set empty (1)explicit unordered_set ( size_type n = /* see below */, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& alloc = allocator_type() );explicit unordered_set ( const allocator_type& alloc );range (2)
template <class InputIterator> unordered_set ( InputIterator first, InputIterator last, size_type n = /* see below */, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& alloc = allocator_type() );copy (3)
unordered_set ( const unordered_set& ust );unordered_set ( const unordered_set& ust, const allocator_type& alloc );move (4)
unordered_set ( unordered_set&& ust );unordered_set ( unordered_set&& ust, const allocator_type& alloc );initializer list (5)
unordered_set ( initializer_list<value_type> il, size_type n = /* see below */, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& alloc = allocator_type() );empty (1)
unordered_set();explicit unordered_set ( size_type n, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& alloc = allocator_type() );explicit unordered_set ( const allocator_type& alloc ); unordered_set ( size_type n, const allocator_type& alloc ); unordered_set ( size_type n, const hasher& hf, const allocator_type& alloc );range (2)
template <class InputIterator> unordered_set ( InputIterator first, InputIterator last, size_type n = /* see below */, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& alloc = allocator_type() );template <class InputIterator> unordered_set ( InputIterator first, InputIterator last, size_type n, const allocator_type& alloc );template <class InputIterator> unordered_set ( InputIterator first, InputIterator last, size_type n, const hasher& hf, const allocator_type& alloc );copy (3)
unordered_set ( const unordered_set& ust );unordered_set ( const unordered_set& ust, const allocator_type& alloc );move (4)
unordered_set ( unordered_set&& ust );unordered_set ( unordered_set&& ust, const allocator_type& alloc );initializer list (5)
unordered_set ( initializer_list<value_type> il, size_type n = /* see below */, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& alloc = allocator_type() );unordered_set ( initializer_list<value_type> il, size_type n, const allocator_type& alloc );unordered_set ( initializer_list<value_type> il, size_type n, const hasher& hf, const allocator_type& alloc );
Construct unordered_set
Constructs an unordered_set container object, initializing its contents depending on the constructor version used:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// constructing unordered_sets
#include <iostream>
#include <string>
#include <unordered_set>
template<class T>
T cmerge (T a, T b) { T t(a); t.insert(b.begin(),b.end()); return t; }
int main ()
{
std::unordered_set<std::string> first; // empty
std::unordered_set<std::string> second ( {"red","green","blue"} ); // init list
std::unordered_set<std::string> third ( {"orange","pink","yellow"} ); // init list
std::unordered_set<std::string> fourth ( second ); // copy
std::unordered_set<std::string> fifth ( cmerge(third,fourth) ); // move
std::unordered_set<std::string> sixth ( fifth.begin(), fifth.end() ); // range
std::cout << "sixth contains:";
for (const std::string& x: sixth) std::cout << " " << x;
std::cout << std::endl;
return 0;
}
sixth contains: pink yellow red green orange blue
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4