41 #ifndef PB_DS_TRIE_POLICY_HPP 42 #define PB_DS_TRIE_POLICY_HPP 51 #define PB_DS_CLASS_T_DEC \ 52 template<typename String, typename String::value_type Min_E_Val, \ 53 typename String::value_type Max_E_Val, bool Reverse, \ 56 #define PB_DS_CLASS_C_DEC \ 57 trie_string_access_traits<String, Min_E_Val,Max_E_Val,Reverse,_Alloc> 70 typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,
71 typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,
77 typedef typename _Alloc::size_type size_type;
78 typedef String key_type;
79 typedef typename _Alloc::template rebind<key_type> __rebind_k;
80 typedef typename __rebind_k::other::const_reference key_const_reference;
88 typedef typename detail::__conditional_type<Reverse, \
89 typename String::const_reverse_iterator, \
93 typedef typename std::iterator_traits<const_iterator>::value_type
e_type;
97 min_e_val = Min_E_Val,
98 max_e_val = Max_E_Val,
99 max_size = max_e_val - min_e_val + 1
101 PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2);
106 begin(key_const_reference);
111 end(key_const_reference);
114 inline static size_type
119 begin_imp(key_const_reference, detail::false_type);
122 begin_imp(key_const_reference, detail::true_type);
125 end_imp(key_const_reference, detail::false_type);
128 end_imp(key_const_reference, detail::true_type);
130 static detail::integral_constant<int, Reverse> s_rev_ind;
135 #undef PB_DS_CLASS_T_DEC 136 #undef PB_DS_CLASS_C_DEC 138 #define PB_DS_CLASS_T_DEC \ 139 template<typename Node_CItr,typename Node_Itr, \ 140 typename _ATraits, typename _Alloc> 142 #define PB_DS_CLASS_C_DEC \ 143 trie_prefix_search_node_update<Node_CItr, Node_Itr, \ 146 #define PB_DS_TRIE_POLICY_BASE \ 147 detail::trie_policy_base<Node_CItr,Node_Itr,_ATraits, _Alloc> 151 template<
typename Node_CItr,
158 typedef PB_DS_TRIE_POLICY_BASE
base_type;
161 typedef typename base_type::key_type key_type;
162 typedef typename base_type::key_const_reference key_const_reference;
176 typedef Node_Itr node_iterator;
177 typedef Node_CItr node_const_iterator;
178 typedef typename node_iterator::value_type iterator;
179 typedef typename node_const_iterator::value_type const_iterator;
204 operator()(node_iterator node_it, node_const_iterator end_nd_it)
const;
212 virtual const_iterator
220 virtual node_const_iterator
221 node_begin()
const = 0;
224 virtual node_iterator
228 virtual node_const_iterator
229 node_end()
const = 0;
232 virtual node_iterator
237 get_access_traits()
const = 0;
242 #undef PB_DS_CLASS_C_DEC 244 #define PB_DS_CLASS_C_DEC \ 245 trie_order_statistics_node_update<Node_CItr, Node_Itr, \ 249 template<
typename Node_CItr,
256 typedef PB_DS_TRIE_POLICY_BASE
base_type;
259 typedef _ATraits access_traits;
260 typedef typename access_traits::const_iterator a_const_iterator;
261 typedef _Alloc allocator_type;
262 typedef typename allocator_type::size_type size_type;
263 typedef typename base_type::key_type key_type;
264 typedef typename base_type::key_const_reference key_const_reference;
266 typedef size_type metadata_type;
267 typedef Node_CItr node_const_iterator;
268 typedef Node_Itr node_iterator;
269 typedef typename node_const_iterator::value_type const_iterator;
270 typedef typename node_iterator::value_type iterator;
276 inline const_iterator
306 operator()(node_iterator, node_const_iterator)
const;
309 typedef typename base_type::const_reference const_reference;
310 typedef typename base_type::const_pointer const_pointer;
312 typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
313 typedef typename __rebind_m::other __rebind_ma;
314 typedef typename __rebind_ma::const_reference metadata_const_reference;
315 typedef typename __rebind_ma::reference metadata_reference;
331 virtual node_const_iterator
332 node_begin()
const = 0;
335 virtual node_iterator
340 virtual node_const_iterator
341 node_end()
const = 0;
344 virtual node_iterator
348 virtual access_traits&
349 get_access_traits() = 0;
354 #undef PB_DS_CLASS_T_DEC 355 #undef PB_DS_CLASS_C_DEC 356 #undef PB_DS_TRIE_POLICY_BASE
Struct holding two objects of arbitrary type.
The standard allocator, as per [20.4].
allocator_type::size_type size_type
Size type.
access_traits::const_iterator a_const_iterator
Const element iterator.
GNU extensions for policy-based data structures for public use.
Functor updating ranks of entrees.
detail::__conditional_type< Reverse, typename String::const_reverse_iterator, typename String::const_iterator >::__type const_iterator
Element const iterator type.
Base class for trie policies.
static const_iterator end(key_const_reference)
Returns a const_iterator to the after-last element of key_const_reference argument.
void operator()(node_iterator node_it, node_const_iterator end_nd_it) const
Called to update a node's metadata.
size_type order_of_key(key_const_reference) const
Returns the order of a key within a sequence. For exapmle, if r_key is the smallest key,...
std::iterator_traits< const_iterator >::value_type e_type
Element type.
_Alloc allocator_type
_Alloc type.
static const_iterator begin(key_const_reference)
Returns a const_iterator to the first element of key_const_reference agumnet.
const_iterator find_by_order(size_type) const
Finds an entry by __order. Returns a const_iterator to the entry with the __order order,...
size_type order_of_prefix(a_const_iterator, a_const_iterator) const
Returns the order of a prefix within a sequence. For exapmle, if [b, e] is the smallest prefix,...
A node updator that allows tries to be searched for the range of values that match a certain prefix.
basic_string< char > string
A string of char.
Represents no type, or absence of type, for template tricks.
static size_type e_pos(e_type e)
Maps an element to a position.
std::pair< const_iterator, const_iterator > prefix_range(key_const_reference) const
Finds the const iterator range corresponding to all values whose prefixes match r_key.
void operator()(node_iterator, node_const_iterator) const
Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
_ATraits access_traits
Element access traits.