logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

FBB::Hash - Various mapping template classes using hashing

Author

       Frank B. Brokken (f.b.brokken@rug.nl).

libbobcat-dev_6.07.01                               2005-2025                                 FBB::Hash(3bobcat)

Bobcat

       Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.

Bobcat Project Files

       o      https://fbb-git.gitlab.io/bobcat/: gitlab project page;

       Debian Bobcat project files:

       o      libbobcat6: debian package containing the shared library, changelog and copyright note;

       o      libbobcat-dev:  debian package containing the static library, headers, manual pages, and developer
              info;

Bugs

       None Reported.

Constructors

       Variants  of  the  FBB::Hash  container  are  available  for  charconst* or std::string keys, used case
       sensitively or case insensitively.

       All variants support default and move construction (as well as  move  assignment),  support  construction
       from  initializer lists. and support construction from iterators defining a half-open range of value_type
       values.

       The following variants are available (showing their default constructors). Value refers to the value type
       stored in the hash table.

       o      HashCharPtr<Value>():
              this hash table uses casesensitivecharconst* keys;

       o      HashCharCasePtr<Value>():
              this hash table uses caseinsensitivecharconst* keys;

       o      HashString<Value>():
              this hash table uses casesensitivestd::string keys;

       o      HashStringCase<Value>():
              this hash table uses caseinsensitivestd::string keys;

Description

       The  FBB:Hash  group of template classes offer hashing-based mapping. Various variants are available, all
       based on the facilities offered by the unordered_map.

       The hash-map offered in the unordered_map container has a fairly complex construction interface, and Hash
       is an attempt to simplify this part of its 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.
       Hash merely requires its users to specify the map’s value type, while the key may be a charconst*  or
       std::string, used case sensitively or case insensitively.

Example

           #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;
           }

Files

bobcat/hash - defines the class interface

Inherits From

std::unordered_map, using various instantiations.

Member Functions

       All members of the unordered_map container are available, as Hash inherits from this template class.

Name

       FBB::Hash - Various mapping template classes using hashing

Namespace

FBB
       All  constructors,  members,  operators  and manipulators, mentioned in this man-page, are defined in the
       namespace FBB.

Overloaded Operator

       In addition to the index operator inherited from unordered_map the overloaded copy  and  move  assignment
       operators are available for all Hash containers.

See Also

bobcat(7)

Synopsis

#include<bobcat/hash>

Type

       All variants define value_type as the corresponding unordered_mapvalue_type. In  practice  a  value_type
       defines a std::pair<Key,Value>, where Key represents the hash’s key-type and Value represents the hash’s
       value type.

See Also