Adobe Source Libraries 1.49.0
A collection of C++ libraries.
|
A simple lookup table of fixed size. [under review]. More...
#include <static_table.hpp>
Public Types | |
typedef Traits | traits_type |
typedef traits_type::key_type | key_type |
typedef traits_type::value_type | value_type |
typedef traits_type::entry_type | entry_type |
Public Member Functions | |
const value_type & | operator() (const key_type &key) const |
bool | operator() (const key_type &key, value_type &result) const |
void | sort () |
Public Attributes | |
entry_type | table_m [Size] |
static_table is intended to encapsulate the code used to initialize, sort, and perform lookups on lookup tables of static size. They are intended to be initialized without runtime code, though they must be sorted at runtime before any lookups can occur. Performing a lookup before the table is sorted will have undefined results.
Definition at line 221 of file static_table.hpp.
typedef Traits traits_type |
The static_table_traits used to extend this static_table's functionality.
Definition at line 222 of file static_table.hpp.
typedef traits_type::key_type key_type |
The type used for lookups in the table.
Definition at line 223 of file static_table.hpp.
typedef traits_type::value_type value_type |
The resultant type from a table lookup.
Definition at line 224 of file static_table.hpp.
typedef traits_type::entry_type entry_type |
A pair comprised of a key_type and a value_type.
Definition at line 225 of file static_table.hpp.
const value_type & operator() | ( | const key_type & | key | ) | const |
key | The key whose stored value we are searching for. |
std::logic_error | Thrown if the key does not exist in the table. |
key
.Definition at line 227 of file static_table.hpp.
bool operator() | ( | const key_type & | key, |
value_type & | result ) const |
key | The key whose stored value we are searching for. |
result | Set to the value associated with the key if key is found. |
None | Guaranteed not to throw. |
true
if key
was found and result's assignment did not throw. false
otherwise.Definition at line 236 of file static_table.hpp.
void sort | ( | ) |
Sorts the contents of the table according to the static_table_traits type.
Definition at line 247 of file static_table.hpp.
entry_type table_m[Size] |
The static lookup table contents. This variable is not intended to be manipulated directly. It is publicly available to support static table initialization by the C++ compiler.
Definition at line 250 of file static_table.hpp.