|
| stable_trie_base () |
| 空のコンテナを構築する [詳解]
|
|
| stable_trie_base (allocator_type const &alloc) |
| アロケータを指定して空のコンテナを構築する [詳解]
|
|
template<typename InputIterator , typename std::enable_if_t< std::is_integral_v< typename std::iterator_traits< InputIterator >::value_type >, std::nullptr_t > = nullptr> |
| stable_trie_base (InputIterator first, InputIterator last, allocator_type const &alloc=allocator_type()) |
| 直列化データからの構築 [詳解]
|
|
template<typename InputIterator , typename std::enable_if_t< std::negation_v< std::is_integral< typename std::iterator_traits< InputIterator >::value_type >>, std::nullptr_t > = nullptr> |
| stable_trie_base (InputIterator first, InputIterator last, allocator_type const &alloc=allocator_type()) |
| 文字列リストからの構築 [詳解]
|
|
| stable_trie_base (std::initializer_list< trie_node > il, allocator_type const &alloc=allocator_type()) |
| 初期化子リストからの構築 [詳解]
|
|
template<typename InputIterator , typename std::enable_if_t< std::is_integral_v< typename std::iterator_traits< InputIterator >::value_type >, std::nullptr_t > = nullptr> |
void | assign (InputIterator first, InputIterator last) |
| 直列化データからの割り当て [詳解]
|
|
template<typename InputIterator , typename std::enable_if_t< std::negation_v< std::is_integral< typename std::iterator_traits< InputIterator >::value_type >>, std::nullptr_t > = nullptr> |
void | assign (InputIterator first, InputIterator last) |
| 文字列リストからの割り当て [詳解]
|
|
reference | at (const_iterator pos, index_type &idx) |
| 葉の値への参照を返す [詳解]
|
|
reference | at (const_iterator pos) |
| 葉の値への参照を返す [詳解]
|
|
const_reference | at (const_iterator pos) const |
| 葉の値への参照を返す [詳解]
|
|
template<typename InputIterator > |
reference | at (InputIterator first, InputIterator last) |
| 葉の値への参照を返す [詳解]
|
|
template<typename InputIterator > |
const_reference | at (InputIterator first, InputIterator last) const |
| 葉の値への参照を返す [詳解]
|
|
template<typename Key > |
reference | at (Key const &key) |
| 葉の値への参照を返す [詳解]
|
|
template<typename Key > |
const_reference | at (Key const &key) const |
| 葉の値への参照を返す [詳解]
|
|
template<typename Key > |
reference | operator[] (Key const &key) |
| 葉の値への参照を返す [詳解]
|
|
const_iterator | begin () const noexcept |
| 根を指すイテレータを返す [詳解]
|
|
const_iterator | cbegin () const noexcept |
| 根を指すイテレータを返す [詳解]
|
|
const_iterator | end () const noexcept |
| 根の終端を指すイテレータを返す [詳解]
|
|
const_iterator | cend () const noexcept |
| 根の終端を指すイテレータを返す [詳解]
|
|
bool | empty () const noexcept |
| キー文字列を格納していないことを調べる [詳解]
|
|
size_type | size () const noexcept |
| 格納しているキー文字列数を調べる [詳解]
|
|
template<typename InputIterator > |
const_iterator | insert (InputIterator first, InputIterator last, value_type value=0) |
| キー文字列を挿入する [詳解]
|
|
template<typename Key > |
const_iterator | insert (Key const &key, value_type value=0) |
| キー文字列を挿入する [詳解]
|
|
void | erase (const_iterator pos) |
| キー文字列を削除する [詳解]
|
|
template<typename InputIterator > |
void | erase (InputIterator first, InputIterator last) |
| キー文字列を削除する [詳解]
|
|
template<typename Key > |
void | erase (Key const &key) |
| キー文字列を削除する [詳解]
|
|
void | swap (stable_trie_base &other) |
|
template<typename InputIterator > |
auto | lookup (InputIterator first, InputIterator last) const |
| 部分一致検索 [詳解]
|
|
template<typename Key > |
const_iterator | search (Key const &key) const |
| 前方一致検索 [詳解]
|
|
template<typename InputIterator > |
const_iterator | find (InputIterator first, InputIterator last) const |
| 完全一致検索 [詳解]
|
|
template<typename Key > |
const_iterator | find (Key const &key) const |
| 完全一致検索 [詳解]
|
|
template<typename InputIterator > |
bool | contains (InputIterator first, InputIterator last) const |
| キー文字列が格納されているか調べる [詳解]
|
|
template<typename Key > |
bool | contains (Key const &key) const |
| キー文字列が格納されているか調べる [詳解]
|
|
allocator_type | get_allocator () const |
| コンテナに関連付けられているアロケータを返す [詳解]
|
|
serialize_iterator | ibegin () const |
| 直列化用のイテレータを返す [詳解]
|
|
serialize_iterator | iend () const |
| 直列化用のイテレータを返す [詳解]
|
|
void | clear () noexcept |
| すべての要素を削除する [詳解]
|
|
allocator_type | get_allocator () const |
| コンテナに関連付けられているアロケータを返す [詳解]
|
|
void | assign (InputIterator first, InputIterator last) |
| 直列化データから割り当てる [詳解]
|
|
serialize_iterator | ibegin () const |
| 直列化用のイテレータを返す [詳解]
|
|
serialize_iterator | iend () const |
| 直列化用のイテレータを返す [詳解]
|
|
void | clear () noexcept |
| すべての要素を削除する [詳解]
|
|
void | swap (trie_heap &other) |
|
|
template<typename InputIterator > |
auto | lookup (InputIterator first, InputIterator last, std::uint32_t &i) const |
| 部分一致検索 [詳解]
|
|
index_type | limit () const |
|
index_type | free (index_type idx, index_type before=0) |
|
void | free (index_type base, label_vector const &labels, index_type before=0) |
|
bool | has_child (index_type parent) const |
|
bool | has_null (index_type parent) const |
|
index_type | at (index_type parent, std::uint16_t label) const |
|
index_type | add (index_type parent, std::uint16_t label) |
|
index_type | add (index_type parent, label_vector const &labels) |
|
| trie_heap (allocator_type const &alloc) |
|
| trie_heap (std::initializer_list< trie_node > il, allocator_type const &alloc=allocator_type()) |
| 初期化子リストから構築する [詳解]
|
|
index_type | limit () const |
|
void | reserve (std::size_t n, index_type before=0) |
|
void | allocate (index_type idx, index_type before=0) |
|
void | allocate (index_type base, label_vector const &labels, index_type before=0) |
|
index_type | relocate (index_type parent, index_type from, label_vector const &labels) |
|
index_type | free (index_type idx, index_type before=0) |
|
void | free (index_type base, label_vector const &labels, index_type before=0) |
|
index_type | locate (label_vector const &labels, index_type &before) const |
|
bool | is_free (index_type base, label_vector const &labels) const |
|
bool | is_free (index_type parent, index_type base, label_vector const &labels) const |
|
bool | is_tail (index_type idx) const |
|
bool | has_child (index_type parent) const |
|
bool | has_null (index_type parent) const |
|
bool | has_sibling (index_type idx) const |
|
bool | has_sibling (index_type parent, index_type idx) const |
|
index_type | at (index_type parent, std::uint16_t label) const |
|
index_type | add (index_type parent, std::uint16_t label) |
|
index_type | add (index_type parent, label_vector const &labels) |
|
template<typename Allocator = std::allocator<trie_node>>
class wordring::detail::stable_trie_base< Allocator >
挿入や削除によって葉を指すイテレータが無効とならない安定なTrie木の実装
- テンプレート引数
-
ダブルアレイの制約により、labelの型は8ビット固定。 葉を指すイテレータ以外は、衝突した場合、無効となる。
このクラスは、文字列末尾の次に葉を表現するnull値を挿入することで葉の安定性を保つ。 null値に子は無いため、挿入や削除によって衝突が起きることが無い。 末尾にnull値が挿入される分、わずかながらメモリー使用量が増える。
このクラスは、葉のINDEXが変わらない必要のある文字列アトム等の用途を想定している。
- 内部構造
下図には実際の木構造とダブル・アレイのデータ配置が含まれる。
trie_base との互換性のため、文字列の末尾と値の格納位置は異なる。 検索によって返されるイテレータは文字列の末尾を指す。 一方、値はさらにnull値で遷移したノードに格納される。 イテレータが文字列末尾を指しているか確認するには、イテレータの operator bool() あるいは operator !() を使う。 値にアクセスするにはコンテナの at() あるいは operator[]() を使う。
以下の表に位置を示す。
格納されている文字列 | find() が返す位置 | 値の格納位置 |
a | 101 | 257 |
ac | 100 | 258 |
b | 102 | 259 |
cab | 99 | 260 |
cd | 107 | 261 |
- 参照
- wordring::basic_trie