2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: hashset.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxHashSet
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxHashSet
|
|
|
|
@wxheader{hashset.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This is a simple, type-safe, and reasonably efficient hash set class,
|
|
|
|
whose interface is a subset of the interface of STL containers. In
|
|
|
|
particular, the interface is modeled after std::set, and the various,
|
|
|
|
non-standard, std::hash_map.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxHashSet
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Copy constructor.
|
|
|
|
*/
|
|
|
|
wxHashSet(size_type size = 10);
|
2008-03-08 09:43:31 -05:00
|
|
|
wxHashSet(const wxHashSet& set);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Returns an iterator pointing at the first element of the hash set.
|
|
|
|
Please remember that hash sets do not guarantee ordering.
|
|
|
|
*/
|
|
|
|
const_iterator begin();
|
2008-03-09 12:24:26 -04:00
|
|
|
const iterator begin();
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Removes all elements from the hash set.
|
|
|
|
*/
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Counts the number of elements with the given key present in the set.
|
|
|
|
This function returns only 0 or 1.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
size_type count(const key_type& key) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the hash set does not contain any elements, @false otherwise.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool empty() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Returns an iterator pointing at the one-after-the-last element of the hash set.
|
|
|
|
Please remember that hash sets do not guarantee ordering.
|
|
|
|
*/
|
|
|
|
const_iterator end();
|
2008-03-09 12:24:26 -04:00
|
|
|
const iterator end();
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Erases the element pointed to by the iterator. After the deletion
|
|
|
|
the iterator is no longer valid and must not be used.
|
|
|
|
*/
|
|
|
|
size_type erase(const key_type& key);
|
2008-03-08 09:43:31 -05:00
|
|
|
void erase(iterator it);
|
|
|
|
void erase(const_iterator it);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
If an element with the given key is present, the functions returns
|
|
|
|
an iterator pointing at that element, otherwise an invalid iterator
|
|
|
|
is returned (i.e. hashset.find( non_existent_key ) == hashset.end()).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
iterator find(const key_type& key) const;
|
|
|
|
const_iterator find(const key_type& key) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Inserts the given value in the hash set. The return value is
|
|
|
|
equivalent to a @c std::pairwxHashMap::iterator, bool;
|
|
|
|
the iterator points to the inserted element, the boolean value
|
|
|
|
is @true if @c v was actually inserted.
|
|
|
|
*/
|
|
|
|
Insert_Result insert(const value_type& v);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of elements in the set.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
size_type size() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|