FBB::Hash − Various mapping template classes using hashing
#include <bobcat/hash>
The FBB:Hash group of template classes offer hashing−based mapping. Various variants are availabe, all based on the facilities offered by the GNU g++(1) ext/hash_map header file. Hashing containers are not (yet) part of the ANSI−ISO C++ standard, and an extension to the standard is offered by GNU’s g++(1) compiler. GNU’s hash map is defined in the __gnu_cxx namespace, indicating that this container is not one that is offered in the C++ standard.
Unfortunately, the hash−map offered in the ext/hash_map header file has a fairly complex interface, and FBB::Hash is an attempt to simplify this interface. In practice, hashing uses a textual key, which may be std::string or char * based, and the keys may be used either case sensitively or case insensitively. FBB::Hash simplifies the use of the hash map offered in ext/hash_map by requiring its users to specify only the map’s value type.
FBB
All constructors, members, operators and manipulators,
mentioned in this man−page, are defined in the
namespace FBB.
__gnu_cxx::hash_map, using various instantiations.
Using case sensitive char const * keys:
|
o |
HashCharPtr<Value>(): |
The default constructor creates an empty hash−map container, in which the keys are char const *s. The map contains value of template type Value.
|
o |
HashCharPtr<Value>(InputIterator begin, InputIterator end): |
This constructor creates a hash−map container, using elements pointed to by a pair of iterators in the hash−map. The iterators must point to std::pair<char const *, Value> objects.
Using case insensitive char const * keys:
|
o |
HashCharCasePtr<Value>(): |
The default constructor creates an empty hash−map container, in which the keys are char const *s. The map contains value of template type Value.
|
o |
HashCharCasePtr<Value>(InputIterator begin, InputIterator end): |
This constructor creates a hash−map container, using elements pointed to by a pair of iterators in the hash−map. The iterators must point to std::pair<char const *, Value> objects.
Using case sensitive std::string keys:
|
o |
HashString<Value>(): |
The default constructor creates an empty hash−map container, in which the keys are std::strings. The map contains value of template type Value.
|
o |
HashString<Value>(InputIterator begin, InputIterator end): |
This constructor creates a hash−map container, using elements pointed to by a pair of iterators in the hash−map. The iterators must point to std::pair<std::string, Value> objects.
Using case insensitive std::string keys:
|
o |
HashStringCase<Value>(): |
The default constructor creates an empty hash−map container, in which the keys are std::strings. The map contains value of template type Value.
|
o |
HashStringCase<Value>(InputIterator begin, InputIterator end): |
This constructor creates a hash−map container, using elements pointed to by a pair of iterators in the hash−map. The iterators must point to std::pair<std::string, Value> objects. The copy constructor is available for all FBB:Hash... hash−map containers.
The overloaded assignment operator is available for all FBB:Hash hash−map containers.
All members of __gnu_cxx::hash_map are available, as FBB::Hash inherits from this template class. These members are (expected to be) the same members as available for the std::map container.
#include
<iostream>
#include <bobcat/hash>
using namespace
std;
using namespace FBB;
pair<char
const *, size_t> ap[] =
{
pair<char const *, size_t>("one", 1),
pair<char const *, size_t>("two", 2),
};
int main()
{
HashCharPtr<size_t> hcp;
HashCharPtr<size_t> hcp2(ap, ap + 2);
HashCharPtr<size_t> hcp3(hcp2);
hcp = hcp2;
cout <<
hcp2["one"] << endl;
}
bobcat/hash − defines the class interface
bobcat(7), g++(1), ext/hash_map
None Reported.
|
o |
bobcat_2.08.01−x.dsc: detached signature; | ||
|
o |
bobcat_2.08.01−x.tar.gz: source archive; | ||
|
o |
bobcat_2.08.01−x_i386.changes: change log; | ||
|
o |
libbobcat1_2.08.01−x_*.deb: debian package holding the libraries; | ||
|
o |
libbobcat1−dev_2.08.01−x_*.deb: debian package holding the libraries, headers and manual pages; | ||
|
o |
http://sourceforge.net/projects/bobcat: public archive location; |
Bobcat is an acronym of ‘Brokken’s Own Base Classes And Templates’.
This is free software, distributed under the terms of the GNU General Public License (GPL).
Frank B. Brokken (f.b.brokken [AT] rug.nl).