41 #ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP 42 #define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP 51 #define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \ 52 template<typename Type_Traits, bool Set, typename _ATraits> 54 #define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \ 55 synth_access_traits<Type_Traits, Set, _ATraits> 58 template<
typename Type_Traits,
bool Set,
typename _ATraits>
61 typedef _ATraits base_type;
62 typedef typename base_type::const_iterator const_iterator;
63 typedef Type_Traits type_traits;
64 typedef typename type_traits::const_reference const_reference;
65 typedef typename type_traits::key_const_reference key_const_reference;
72 equal_prefixes(const_iterator, const_iterator, const_iterator,
73 const_iterator,
bool compare_after =
true)
const;
76 equal_keys(key_const_reference, key_const_reference)
const;
79 cmp_prefixes(const_iterator, const_iterator, const_iterator,
80 const_iterator,
bool compare_after =
false)
const;
83 cmp_keys(key_const_reference, key_const_reference)
const;
85 inline static key_const_reference
86 extract_key(const_reference);
90 operator()(key_const_reference, key_const_reference);
94 inline static key_const_reference
95 extract_key(const_reference, true_type);
97 inline static key_const_reference
98 extract_key(const_reference, false_type);
100 static integral_constant<int, Set> s_set_ind;
103 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
104 integral_constant<int,Set>
105 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind;
107 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
108 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
109 synth_access_traits()
112 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
113 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
114 synth_access_traits(
const _ATraits& r_traits)
118 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
120 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
121 equal_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
122 const_iterator e_r,
bool compare_after )
const 128 if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))
133 return (!compare_after || b_r == e_r);
136 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
138 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
139 equal_keys(key_const_reference r_lhs_key,
140 key_const_reference r_rhs_key)
const 149 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
151 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
152 cmp_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
153 const_iterator e_r,
bool compare_after )
const 160 const typename base_type::size_type l_pos = base_type::e_pos(*b_l);
161 const typename base_type::size_type r_pos = base_type::e_pos(*b_r);
163 return l_pos < r_pos;
173 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
175 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
176 cmp_keys(key_const_reference r_lhs_key,
177 key_const_reference r_rhs_key)
const 186 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
187 inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
188 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
189 extract_key(const_reference r_val)
190 {
return extract_key(r_val, s_set_ind); }
192 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
193 inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
194 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
195 extract_key(const_reference r_val,
true_type)
198 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
199 inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
200 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
201 extract_key(const_reference r_val,
false_type)
202 {
return r_val.first; }
204 #ifdef _GLIBCXX_DEBUG 205 PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
207 PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
208 operator()(key_const_reference r_lhs, key_const_reference r_rhs)
209 {
return cmp_keys(r_lhs, r_rhs); }
212 #undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC 213 #undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
Synthetic element access traits.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
GNU extensions for policy-based data structures for public use.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.