// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // // ==++== // // // // ==--== /*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XX XX unordered_set XX XX XX XX Derives from hashtable for most implementation. The hash key is the XX XX elements themselves XX XX XX XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ #pragma once #include "allocator.h" #include "hashtable.h" namespace jitstd { template , typename Pred = jitstd::equal_to, typename Alloc = jitstd::allocator> class unordered_set : public hashtable { public: typedef Value key_type; typedef Value value_type; typedef Hash hasher; typedef Pred key_equal; typedef Alloc allocator_type; typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef typename list::iterator iterator; typedef typename list::const_iterator const_iterator; typedef typename list::iterator local_iterator; private: typedef hashtable base_type; unordered_set(); typedef pair BucketEntry; typedef vector::allocator> Buckets; typedef list Elements; public: explicit unordered_set(size_type, const allocator_type& a); unordered_set(size_type n, const hasher& hf, const key_equal& eq, const allocator_type&); template unordered_set( InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eq, const allocator_type&); explicit unordered_set(const allocator_type&); unordered_set(const unordered_set& other); ~unordered_set(); unordered_set& operator=(unordered_set const&); }; } // end of namespace jitstd namespace jitstd { template unordered_set::unordered_set( size_type n, allocator_type const& allocator) : hashtable(n, allocator) { this->rehash(n); } template unordered_set::unordered_set( size_type n, hasher const& hf, key_equal const& eq, allocator_type const& allocator) : hashtable(n, hf, eq, allocator) { this->rehash(n); } template template unordered_set::unordered_set( InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eq, const allocator_type& allocator) : hashtable(f, l, n, hf, eq, allocator) { this->rehash(n); insert(this->first, this->last); } template unordered_set::unordered_set(const allocator_type& allocator) : hashtable(allocator) { } template unordered_set::unordered_set(const unordered_set& other) : hashtable(other) { } template unordered_set::~unordered_set() { } template unordered_set& unordered_set::operator=(unordered_set const& other) { return base_type::operator=(other); } } // end of namespace jitstd.