File key.h#

template<>
struct hash<sym::Key>#

Public Functions

std::size_t operator()(const sym::Key &key) const#
template<>
struct hash<sym::key_t>#

Public Functions

std::size_t operator()(const sym::key_t &key) const#
namespace sym

Functions

std::ostream &operator<<(std::ostream &os, const sym::Key &key)#

Print implementation for Key.

Examples:

Key('C', 13) -> "C_13"
Key('f') -> "f"
Key('f', 32, 2) -> "f_32_2"
Key('A', -2, 123) -> "A_n2_123"
Key() -> "NULLKEY"

class Key
#include <key.h>

Key type for Values

Contains a letter plus an integral subscript and superscript. Can construct with a letter, a letter + sub, or a letter + sub + super, but not letter + super.

TODO(hayk): Consider an abstraction where Key contains a type enum.

Public Types

using letter_t = char
using subscript_t = std::int64_t
using superscript_t = std::int64_t

Public Functions

constexpr Key() = default
inline constexpr Key(const letter_t letter, const subscript_t sub = kInvalidSub, const superscript_t super = kInvalidSuper)
inline constexpr Key(const key_t &key)
inline constexpr letter_t Letter() const noexcept
inline constexpr subscript_t Sub() const noexcept
inline constexpr superscript_t Super() const noexcept
inline constexpr Key WithLetter(const letter_t letter) const
inline constexpr Key WithSub(const subscript_t sub) const
inline constexpr Key WithSuper(const superscript_t super) const
inline key_t GetLcmType() const noexcept
inline constexpr bool operator==(const Key &other) const noexcept
inline constexpr bool operator!=(const Key &other) const noexcept

Public Static Functions

static bool LexicalLessThan(const Key &a, const Key &b)

Return true if a is LESS than b, in dictionary order of the tuple (letter, sub, super).

Public Static Attributes

static constexpr letter_t kInvalidLetter = static_cast<letter_t>(0)
static constexpr subscript_t kInvalidSub = std::numeric_limits<subscript_t>::min()
static constexpr superscript_t kInvalidSuper = std::numeric_limits<superscript_t>::min()

Protected Attributes

letter_t letter_ = {kInvalidLetter}#
subscript_t sub_ = {kInvalidSub}#
superscript_t super_ = {kInvalidSuper}#
struct LexicalCompare
#include <key.h>

Implementation of the Compare spec for use in containers

Public Functions

inline bool operator()(const Key &a, const Key &b) const
namespace std#

Hash function for Key.

template<> Key >

Public Functions

std::size_t operator()(const sym::Key &key) const#
template<> key_t >

Public Functions

std::size_t operator()(const sym::key_t &key) const#