GOTO 
index
trie<Key, Data, Mapping>
Defined in header file:  trie.hh

Description

Example

// mapping if only characters a..z are allowed
struct LowerAlphabet {
    typedef AlphabetMapping<char>::size_type size_type;
    size_type operator()(char c) const { return c - 'a'; }
    size_type min() const { return 0; };
    size_type max() const { return 25; };
};

int main(int argc, char** argv) {
    trie<string, string, LowerAlphabet> t
    trie<string, string, LowerAlphabet>::iterator it;

    t.insert(std::make_pair("abc", "123"));
    t.insert(std::make_pair("def", "456"));
    for (it = t.begin(); it != t.end(); ++it) {
        cout << it->first << " " << it->second << endl;
    }
  

Public base classes

Template parameters

Parameter Description Default
Key    
Data    
Mapping   AlphabetMapping<typename Key::value_type>

Constructors

Constructor Description
trie() Constructor. Creates an empty trie.

Members

Types Description
key_type The key type Key of the trie.
data_type The data type Data of the trie.
value_type The type of the object that is stored in the trie.
pointer Pointer to a data type.
reference Reference to a data type.
const_reference Const reference to a data type.
size_type An unsigned integral type.
difference_type A signed integral type.
iterator Iterator to iterate through the trie.
const_iterator Const iterator to iterate through the trie.
Methods
std::pair<iterator, bool>  insert(const value_type& v) Inserts a key/value pair.
iterator  begin() Returns an iterator pointing to the first element.
const_iterator  begin()   const Returns a const iterator pointing to the first element.
iterator  end() Returns an iterator pointing to the end.
const_iterator  end()   const Returns a const iterator pointing to the end.
iterator  find(const key_type& k) Finds an element whose key is k.
index

Copyright © 2005-2006 Retrieval Solutions. All rights reserved.