DINKUMWARE Ltd -- Leaders in Standard Library implementation. DINKUMWARE Ltd - www.dinkumware.com, Concord MA USA
Home Dinkum Compleat Reference Dinkum Reports Dinkum C++ tr1 Dinkum C++ Dinkum C99 Dinkum Supplemental Dinkum Exam
 
 
 
 
 
 
loading... Searching...
 
<unordered_set>

<unordered_set>

[added with TR1]


Include the STL standard header <unordered_set> to define the container template classes unordered_set and unordered_multiset, and their supporting templates.

namespace std {
    namespace tr1 {
        // DECLARATIONS
template<class Key, class Hash, class Pred, class Alloc>
    class unordered_set;
template<class Key, class Hash, class Pred, class Alloc>
    class unordered_multiset;

        // TEMPLATE FUNCTIONS
template<class Key, class Hash, class Pred, class Alloc>
    void swap(
        unordered_set<Key, Hash, Pred, Alloc>& left,
        unordered_set<Key, Hash, Pred, Alloc>& right);
template<class Key, class Hash, class Pred, class Alloc>
    void swap(
        unordered_multiset<Key, Hash, Pred, Alloc>& left,
        unordered_multiset<Key, Hash, Pred, Alloc>& right);
    } // namespace tr1
}  // namespace std

unordered_multiset


allocator_type · begin · bucket · bucket_count · bucket_size · clear · const_iterator · const_local_iterator · const_pointer · const_reference · count · difference_type · empty · end · equal_range · erase · find · get_allocator · hasher · hash_function · insert · iterator · key_eq · key_equal · key_type · load_factor · local_iterator · max_bucket_count · max_load_factor · max_size · pointer · reference · rehash · size · size_type · swap · unordered_multiset · value_type


template<class Key,
    class Hash = std::tr1::hash<Key>,
    class Pred = std::equal_to<Key>,
    class Alloc = std::allocator<Key> >
    class unordered_multiset {
public:
    typedef Key key_type;
    typedef Key value_type;
    typedef Hash hasher;
    typedef Pred key_equal;
    typedef Alloc allocator_type;

    typedef Alloc::pointer pointer;
    typedef Alloc::const_pointer const_pointer;
    typedef Alloc::reference reference;
    typedef Alloc::const_reference const_reference;

    typedef T0 iterator;
    typedef T1 const_iterator;
    typedef T2 size_type;
    typedef T3 difference_type;
    typedef T4 local_iterator;
    typedef T5 const_local_iterator;

    unordered_multiset(
        const unordered_multiset& right);
    explicit unordered_multiset(
        size_type nbuckets = N0,
        const Hash& hfn = Hash(),
        const Pred& comp = Pred(),
        const Alloc& al = Alloc());
    template<class InIt>
        unordered_multiset(
        InIt first, InIt last,
        size_type nbuckets = N0,
        const Hash& hfn = Hash(),
        const Pred& comp = Pred(),
        const Alloc& al = Alloc());

    iterator begin();
    const_iterator begin() const;
    local_iterator begin(size_type nbucket);
    const_local_iterator begin(size_type nbucket) const;

    iterator end();
    const_iterator end() const;
    local_iterator end(size_type nbucket);
    const_local_iterator end(size_type nbucket) const;

    size_type size() const;
    size_type max_size() const;
    bool empty() const;

    size_type bucket_count() const;
    size_type max_bucket_count() const;
    size_type bucket(const Key& keyval) const;
    size_type bucket_size(size_type nbucket) const;

    Hash hash_function() const;
    Pred key_eq() const;
    Alloc get_allocator() const;

    float load_factor() const;
    float max_load_factor() const;
    void max_load_factor(float factor);
    void rehash(size_type nbuckets);

    iterator insert(const value_type& val);
    iterator insert(iterator where, const value_type& val);
    template<class InIt>
        void insert(InIt first, InIt last);

    iterator erase(iterator where);
    iterator erase(iterator first, iterator last);
    size_type erase(const Key& keyval);
    void clear();

    void swap(unordered_multiset& right);

    const_iterator find(const Key& keyval) const;
    size_type count(const     std::pair<iterator, iterator>
        equal_range(const Key& keyval);
std::pair<const_iterator, const_iterator>
        equal_range(const Key& keyval) const;
    };

The template class describes an object that controls a varying-length sequence of elements of type const Key. The sequence is weakly ordered by a hash function, which partitions the sequence into an ordered set of subsequences called buckets. Within each bucket a comparison function determines whether any pair of elements has equivalent ordering. Each element serves as both a sort key and a value. The sequence is represented in a way that permits lookup, insertion, and removal of an arbitrary element with a number of operations that can be independent of the number of elements in the sequence (constant time), at least when all buckets are of roughly equal length. In the worst case, when all of the elements are in one bucket, the number of operations is proportional to the number of elements in the sequence (linear time). Moreover, inserting an element invalidates no iterators, and removing an element invalidates only those iterators which point at the removed element.

The object orders the sequence it controls by calling two stored objects, a comparison function object of type key_equal and a hash function object of type hasher. You access the first stored object by calling the member function key_eq(); and you access the second stored object by calling the member function hash_function(). Specifically, for all values X and Y of type Key, the call key_eq()(X, Y) returns true only if the two argument values have equivalent ordering; the call hash_function()(keyval) yields a distribution of values of type size_t. Unlike template class unordered_set, an object of template class unordered_multiset does not ensure that key_eq()(X, Y) is always false for any two elements of the controlled sequence. (Keys need not be unique.)

The object also stores a maximum load factor, which specifies the maximum desired average number of elements per bucket. If inserting an element causes load_factor() to exceed the maximum load factor, the container increases the number of buckets and rebuilds the hash table as needed.

The actual order of elements in the controlled sequence depends on the hash function, the comparison function, the order of insertion, the maximum load factor, and the current number of buckets. You cannot in general predict the order of elements in the controlled sequence. You can always be assured, however, that any subset of elements that have equivalent ordering are adjacent in the controlled sequence.

The object allocates and frees storage for the sequence it controls through a stored allocator object of type allocator_type. Such an allocator object must have the same external interface as an object of template class allocator. Note that the stored allocator object is not copied when the container object is assigned.

unordered_multiset::allocator_type

typedef Alloc allocator_type;

The type is a synonym for the template parameter Alloc.

unordered_multiset::begin

iterator begin();
    const_iterator begin() const;
    local_iterator begin(size_type nbucket);
    const_local_iterator begin(size_type nbucket) const;

The first two member functions return a forward iterator that points at the first element of the sequence (or just beyond the end of an empty sequence). The last two member functions return a forward iterator that points at the first element of bucket nbucket (or just beyond the end of an empty bucket).

unordered_multiset::bucket

size_type bucket(const Key& keyval) const;

The member function returns the bucket number currently corresponding to the key value keyval.

unordered_multiset::bucke_countt

size_type bucket_count() const;

The member function returns the current number of buckets.

unordered_multiset::bucket_size

size_type bucket_size(size_type nbucket) const;

The member functions returns the size of bucket number nbucket.

unordered_multiset::clear

void clear();

The member function calls erase( begin(), end()).

unordered_multiset::const_iterator

typedef T1 const_iterator;

The type describes an object that can serve as a constant forward iterator for the controlled sequence. It is described here as a synonym for the implementation-defined type T1.

unordered_multiset::const_local_iterator

typedef T5 const_local_iterator;

The type describes an object that can serve as a constant forward iterator for a bucket. It is described here as a synonym for the implementation-defined type T5.

unordered_multiset::const_pointer

typedef Alloc::const_pointer const_pointer;

The type describes an object that can serve as a constant pointer to an element of the controlled sequence.

unordered_multiset::const_reference

typedef Alloc::const_reference const_reference;

The type describes an object that can serve as a constant reference to an element of the controlled sequence.

unordered_multiset::count

size_type count(const Key& keyval) const;

The member function returns the number of elements in the range delimited by equal_range(keyval).

unordered_multiset::difference_type

typedef T3 difference_type;

The signed integer type describes an object that can represent the difference between the addresses of any two elements in the controlled sequence. It is described here as a synonym for the implementation-defined type T3.

unordered_multiset::empty

bool empty() const;

The member function returns true for an empty controlled sequence.

unordered_multiset::end

iterator end();
    const_iterator end() const;
    local_iterator end(size_type nbucket);
    const_local_iterator end(size_type nbucket) const;

The first two member functions return a forward iterator that points just beyond the end of the sequence. The last two member functions return a forward iterator that points just beyond the end of bucket nbucket.

unordered_multiset::equal_range

std::pair<iterator, iterator>
    equal_range(const Key& keyval);
std::pair<const_iterator, const_iterator>
    equal_range(const Key& keyval) const;

The member function returns a pair of iterators X such that [X.first, X.second) delimits just those elements of the controlled sequence that have equivalent ordering with keyval. If no such elements exist, both iterators are end().

unordered_multiset::erase

iterator erase(iterator where);
iterator erase(iterator first, iterator last);
size_type erase(const Key& keyval);

The first member function removes the element of the controlled sequence pointed to by where. The second member function removes the elements in the range [first, last). Both return an iterator that designates the first element remaining beyond any elements removed, or end() if no such element exists.

The third member removes the elements in the range delimited by equal_range(keyval). It returns the number of elements it removes.

The member functions never throw an exception.

unordered_multiset::find

const_iterator find(const Key& keyval) const;

The member function returns equal_range(keyval).first.

unordered_multiset::get_allocator

Alloc get_allocator() const;

The member function returns the stored allocator object.

unordered_multiset::hash_function

Hash hash_function() const;

The member function returns the stored hash function object.

unordered_multiset::hasher

typedef Hash hasher;

The type is a synonym for the template parameter Hash.

unordered_multiset::insert

iterator insert(const value_type& val);
iterator insert(iterator where, const value_type& val);
template<class InIt>
    void insert(InIt first, InIt last);

The first member function inserts the element val in the controlled sequence, then returns the iterator that designates the inserted element. The second member function returns insert(val), using where as a starting place within the controlled sequence to search for the insertion point. (Insertion can possibly occur somewhat faster, if the insertion point immediately precedes or follows where.) The third member function inserts the sequence of element values, for each where in the range [first, last), by calling insert(*where).

If an exception is thrown during the insertion of a single element, the container is left unaltered and the exception is rethrown. If an exception is thrown during the insertion of multiple elements, the container is left in a stable but unspecified state and the exception is rethrown.

unordered_multiset::iterator

typedef T0 iterator;

The type describes an object that can serve as a forward iterator for the controlled sequence. It is described here as a synonym for the implementation-defined type T0.

unordered_multiset::key_eq

Pred key_eq() const;

The member function returns the stored comparison function object.

unordered_multiset::key_equal

typedef Pred key_equal;

The type is a synonym for the template parameter Pred.

unordered_multiset::key_type

typedef Key key_type;

The type is a synonym for the template parameter Key.

unordered_multiset::load_factor

float load_factor() const;

The member function returns (float)size() / (float)bucket_count(), the average number of elements per bucket.

unordered_multiset::local_iterator

typedef T4 local_iterator;

The type describes an object that can serve as a forward iterator for a bucket. It is described here as a synonym for the implementation-defined type T4.

unordered_multiset::max_bucket_count

size_type max_bucket_count() const;

The member function returns the maximum number of buckets currently permitted.

unordered_multiset::max_load_factort

float max_load_factor() const;
void max_load_factor(float factor);

The first member function returns the stored maximum load factor. The second member function replaces the stored maximum load factor with factor.

unordered_multiset::max_size

size_type max_size() const;

The member function returns the length of the longest sequence that the object can control.

unordered_multiset::pointer

typedef Alloc::pointer pointer;

The type describes an object that can serve as a pointer to an element of the controlled sequence.

unordered_multiset::reference

typedef Alloc::reference reference;

The type describes an object that can serve as a reference to an element of the controlled sequence.

unordered_multiset::rehash

void rehash(size_type nbuckets);

The member function alters the number of buckets to be at least nbuckets and rebuilds the hash table as needed.

unordered_multiset::size

size_type size() const;

The member function returns the length of the controlled sequence.

unordered_multiset::size_type

typedef T2 size_type;

The unsigned integer type describes an object that can represent the length of any controlled sequence. It is described here as a synonym for the implementation-defined type T2.

unordered_multiset::swap

void swap(unordered_multiset& right);

The member function swaps the controlled sequences between *this and right. If get_allocator() == right.get_allocator(), it does so in constant time, it throws an exception only as a result of copying the stored traits object of type Tr, and it invalidates no references, pointers, or iterators that designate elements in the two controlled sequences. Otherwise, it performs a number of element assignments and constructor calls proportional to the number of elements in the two controlled sequences.

unordered_multiset::unordered_multiset

unordered_multiset(
    const unordered_multiset& right);
explicit unordered_multiset(
    size_type nbuckets = N0,
    const Hash& hfn = Hash(),
    const Pred& comp = Pred(),
    const Alloc& al = Alloc());
template<class InIt>
    unordered_multiset(
    InIt first, InIt last,
    size_type nbuckets = N0,
    const Hash& hfn = Hash(),
    const Pred& comp = Pred(),
    const Alloc& al = Alloc());

The first constructor specifies a copy of the sequence controlled by right. The second constructor specifies an empty controlled sequence. The third constructor inserts the sequence of element values [first, last).

All constructors also initialize several stored values. For the copy constructor, the values are obtained from right. Otherwise:

  • the minimum number of buckets is the argument nbuckets, if present; otherwise it is a default value described here as the implementation-defined value N0.
  • the hash function object is the argument hfn, if present; otherwise it is Hash().
  • the comparison function object is the argument comp, if present; otherwise it is Pred().
  • the allocator object is the argument al, if present; otherwise, it is Alloc().

unordered_multiset::value_type

typedef Key value_type;

The type describes an element of the controlled sequence.

unordered_set


allocator_type · begin · bucket · bucket_count · bucket_size · clear · const_iterator · const_local_iterator · const_pointer · const_reference · count · difference_type · empty · end · equal_range · erase · find · get_allocator · hasher · hash_function · insert · iterator · key_eq · key_equal · key_type · load_factor · local_iterator · max_bucket_count · max_load_factor · max_size · pointer · reference · rehash · size · size_type · swap · unordered_set · value_type


template<class Key,
    class Hash = std::tr1::hash<Key>,
    class Pred = std::equal_to<Key>,
    class Alloc = std::allocator<Key> >
    class unordered_set {
public:
    typedef Key key_type;
    typedef Key value_type;
    typedef Hash hasher;
    typedef Pred key_equal;
    typedef Alloc allocator_type;

    typedef Alloc::pointer pointer;
    typedef Alloc::const_pointer const_pointer;
    typedef Alloc::reference reference;
    typedef Alloc::const_reference const_reference;

    typedef T0 iterator;
    typedef T1 const_iterator;
    typedef T2 size_type;
    typedef T3 difference_type;
    typedef T4 local_iterator;
    typedef T5 const_local_iterator;

    unordered_set(
        const unordered_set& right);
    explicit unordered_set(
        size_type nbuckets = N0,
        const Hash& hfn = Hash(),
        const Pred& comp = Pred(),
        const Alloc& al = Alloc());
    template<class InIt>
        unordered_set(
        InIt first, InIt last,
        size_type nbuckets = N0,
        const Hash& hfn = Hash(),
        const Pred& comp = Pred(),
        const Alloc& al = Alloc());

    iterator begin();
    const_iterator begin() const;
    local_iterator begin(size_type nbucket);
    const_local_iterator begin(size_type nbucket) const;

    iterator end();
    const_iterator end() const;
    local_iterator end(size_type nbucket);
    const_local_iterator end(size_type nbucket) const;

    size_type size() const;
    size_type max_size() const;
    bool empty() const;

    size_type bucket_count() const;
    size_type max_bucket_count() const;
    size_type bucket(const Key& keyval) const;
    size_type bucket_size(size_type nbucket) const;

    Hash hash_function() const;
    Pred key_eq() const;
    Alloc get_allocator() const;

    float load_factor() const;
    float max_load_factor() const;
    void max_load_factor(float factor);
    void rehash(size_type nbuckets);

    iterator insert(const value_type& val);
    iterator insert(iterator where, const value_type& val);
    template<class InIt>
        void insert(InIt first, InIt last);

    iterator erase(iterator where);
    iterator erase(iterator first, iterator last);
    size_type erase(const Key& keyval);
    void clear();

    void swap(unordered_set& right);

    const_iterator find(const Key& keyval) const;
    size_type count(const Key& keyval) const;
    std::pair<iterator, iterator>
        equal_range(const Key& keyval);
    std::pair<const_iterator, const_iterator>
        equal_range(const Key& keyval) const;
    };

The template class describes an object that controls a varying-length sequence of elements of type const Key. The sequence is weakly ordered by a hash function, which partitions the sequence into an ordered set of subsequences called buckets. Within each bucket a comparison function determines whether any pair of elements has equivalent ordering. Each element serves as both a sort key and a value. The sequence is represented in a way that permits lookup, insertion, and removal of an arbitrary element with a number of operations that can be independent of the number of elements in the sequence (constant time), at least when all buckets are of roughly equal length. In the worst case, when all of the elements are in one bucket, the number of operations is proportional to the number of elements in the sequence (linear time). Moreover, inserting an element invalidates no iterators, and removing an element invalidates only those iterators which point at the removed element.

The object orders the sequence it controls by calling two stored objects, a comparison function object of type key_equal and a hash function object of type hasher. You access the first stored object by calling the member function key_eq(); and you access the second stored object by calling the member function hash_function(). Specifically, for all values X and Y of type Key, the call key_eq()(X, Y) returns true only if the two argument values have equivalent ordering; the call hash_function()(keyval) yields a distribution of values of type size_t. Unlike template class unordered_multiset, an object of template class unordered_set ensures that key_eq()(X, Y) is always false for any two elements of the controlled sequence. (Keys are unique.)

The object also stores a maximum load factor, which specifies the maximum desired average number of elements per bucket. If inserting an element causes load_factor() to exceed the maximum load factor, the container increases the number of buckets and rebuilds the hash table as needed.

The actual order of elements in the controlled sequence depends on the hash function, the comparison function, the order of insertion, the maximum load factor, and the current number of buckets. You cannot in general predict the order of elements in the controlled sequence. You can always be assured, however, that any subset of elements that have equivalent ordering are adjacent in the controlled sequence.

The object allocates and frees storage for the sequence it controls through a stored allocator object of type allocator_type. Such an allocator object must have the same external interface as an object of template class allocator. Note that the stored allocator object is not copied when the container object is assigned.

unordered_set::allocator_type

typedef Alloc allocator_type;

The type is a synonym for the template parameter Alloc.

unordered_set::begin

iterator begin();
    const_iterator begin() const;
    local_iterator begin(size_type nbucket);
    const_local_iterator begin(size_type nbucket) const;

The first two member functions return a forward iterator that points at the first element of the sequence (or just beyond the end of an empty sequence). The last two member functions return a forward iterator that points at the first element of bucket nbucket (or just beyond the end of an empty bucket).

unordered_set::bucket

size_type bucket(const Key& keyval) const;

The member function returns the bucket number currently corresponding to the key value keyval.

unordered_set::bucke_countt

size_type bucket_count() const;

The member function returns the current number of buckets.

unordered_set::bucket_size

size_type bucket_size(size_type nbucket) const;

The member functions returns the size of bucket number nbucket.

unordered_set::clear

void clear();

The member function calls erase( begin(), end()).

unordered_set::const_iterator

typedef T1 const_iterator;

The type describes an object that can serve as a constant forward iterator for the controlled sequence. It is described here as a synonym for the implementation-defined type T1.

unordered_set::const_local_iterator

typedef T5 const_local_iterator;

The type describes an object that can serve as a constant forward iterator for a bucket. It is described here as a synonym for the implementation-defined type T5.

unordered_set::const_pointer

typedef Alloc::const_pointer const_pointer;

The type describes an object that can serve as a constant pointer to an element of the controlled sequence.

unordered_set::const_reference

typedef Alloc::const_reference const_reference;

The type describes an object that can serve as a constant reference to an element of the controlled sequence.

unordered_set::count

size_type count(const Key& keyval) const;

The member function returns the number of elements in the range delimited by equal_range(keyval).

unordered_set::difference_type

typedef T3 difference_type;

The signed integer type describes an object that can represent the difference between the addresses of any two elements in the controlled sequence. It is described here as a synonym for the implementation-defined type T3.

unordered_set::empty

bool empty() const;

The member function returns true for an empty controlled sequence.

unordered_set::end

iterator end();
    const_iterator end() const;
    local_iterator end(size_type nbucket);
    const_local_iterator end(size_type nbucket) const;

The first two member functions return a forward iterator that points just beyond the end of the sequence. The last two member functions return a forward iterator that points just beyond the end of bucket nbucket.

unordered_set::equal_range

std::pair<iterator, iterator>
    equal_range(const Key& keyval);
std::pair<const_iterator, const_iterator>
    equal_range(const Key& keyval) const;

The member function returns a pair of iterators X such that [X.first, X.second) delimits just those elements of the controlled sequence that have equivalent ordering with keyval. If no such elements exist, both iterators are end().

unordered_set::erase

iterator erase(iterator where);
iterator erase(iterator first, iterator last);
size_type erase(const Key& keyval);

The first member function removes the element of the controlled sequence pointed to by where. The second member function removes the elements in the range [first, last). Both return an iterator that designates the first element remaining beyond any elements removed, or end() if no such element exists.

The third member removes the elements in the range delimited by equal_range(keyval). It returns the number of elements it removes.

The member functions never throw an exception.

unordered_set::find

const_iterator find(const Key& keyval) const;

The member function returns equal_range(keyval).first.

unordered_set::get_allocator

Alloc get_allocator() const;

The member function returns the stored allocator object.

unordered_set::hash_function

Hash hash_function() const;

The member function returns the stored hash function object.

unordered_set::hasher

typedef Hash hasher;

The type is a synonym for the template parameter Hash.

unordered_set::insert

iterator insert(const value_type& val);
iterator insert(iterator where, const value_type& val);
template<class InIt>
    void insert(InIt first, InIt last);

The first member function inserts the element val in the controlled sequence, then returns the iterator that designates the inserted element. The second member function returns insert(val), using where as a starting place within the controlled sequence to search for the insertion point. (Insertion can possibly occur somewhat faster, if the insertion point immediately precedes or follows where.) The third member function inserts the sequence of element values, for each where in the range [first, last), by calling insert(*where).

If an exception is thrown during the insertion of a single element, the container is left unaltered and the exception is rethrown. If an exception is thrown during the insertion of multiple elements, the container is left in a stable but unspecified state and the exception is rethrown.

unordered_set::iterator

typedef T0 iterator;

The type describes an object that can serve as a forward iterator for the controlled sequence. It is described here as a synonym for the implementation-defined type T0.

unordered_set::key_eq

Pred key_eq() const;

The member function returns the stored comparison function object.

unordered_set::key_equal

typedef Pred key_equal;

The type is a synonym for the template parameter Pred.

unordered_set::key_type

typedef Key key_type;

The type is a synonym for the template parameter Key.

unordered_set::load_factor

float load_factor() const;

The member function returns (float)size() / (float)bucket_count(), the average number of elements per bucket.

unordered_set::local_iterator

typedef T4 local_iterator;

The type describes an object that can serve as a forward iterator for a bucket. It is described here as a synonym for the implementation-defined type T4.

unordered_set::max_bucket_count

size_type max_bucket_count() const;

The member function returns the maximum number of buckets currently permitted.

unordered_set::max_load_factort

float max_load_factor() const;
void max_load_factor(float factor);

The first member function returns the stored maximum load factor. The second member function replaces the stored maximum load factor with factor.

unordered_set::max_size

size_type max_size() const;

The member function returns the length of the longest sequence that the object can control.

unordered_set::pointer

typedef Alloc::pointer pointer;

The type describes an object that can serve as a pointer to an element of the controlled sequence.

unordered_set::reference

typedef Alloc::reference reference;

The type describes an object that can serve as a reference to an element of the controlled sequence.

unordered_set::rehash

void rehash(size_type nbuckets);

The member function alters the number of buckets to be at least nbuckets and rebuilds the hash table as needed.

unordered_set::size

size_type size() const;

The member function returns the length of the controlled sequence.

unordered_set::size_type

typedef T2 size_type;

The unsigned integer type describes an object that can represent the length of any controlled sequence. It is described here as a synonym for the implementation-defined type T2.

unordered_set::swap

void swap(unordered_set& right);

The member function swaps the controlled sequences between *this and right. If get_allocator() == right.get_allocator(), it does so in constant time, it throws an exception only as a result of copying the stored traits object of type Tr, and it invalidates no references, pointers, or iterators that designate elements in the two controlled sequences. Otherwise, it performs a number of element assignments and constructor calls proportional to the number of elements in the two controlled sequences.

unordered_set::unordered_set

unordered_set(
    const unordered_set& right);
explicit unordered_set(
    size_type nbuckets = N0,
    const Hash& hfn = Hash(),
    const Pred& comp = Pred(),
    const Alloc& al = Alloc());
template<class InIt>
    unordered_set(
    InIt first, InIt last,
    size_type nbuckets = N0,
    const Hash& hfn = Hash(),
    const Pred& comp = Pred(),
    const Alloc& al = Alloc());

The first constructor specifies a copy of the sequence controlled by right. The second constructor specifies an empty controlled sequence. The third constructor inserts the sequence of element values [first, last).

All constructors also initialize several stored values. For the copy constructor, the values are obtained from right. Otherwise:

  • the minimum number of buckets is the argument nbuckets, if present; otherwise it is a default value described here as the implementation-defined value N0.
  • the hash function object is the argument hfn, if present; otherwise it is Hash().
  • the comparison function object is the argument comp, if present; otherwise it is Pred().
  • the allocator object is the argument al, if present; otherwise, it is Alloc().

unordered_set::value_type

typedef Key value_type;

The type describes an element of the controlled sequence.

swap

template<class Key, class Hash, class Pred, class Alloc>
    void swap(
        unordered_multiset <Key, Hash, Pred, Alloc>& left,
        unordered_multiset <Key, Hash, Pred, Alloc>& right);
template<class Key, class Hash, class Pred, class Alloc>
    void swap(
        unordered_set <Key, Hash, Pred, Alloc>& left,
        unordered_set <Key, Hash, Pred, Alloc>& right);

The template function executes left.swap(right).


See also the Table of Contents and the Index.

Copyright © 1992-2006 by P.J. Plauger. All rights reserved.