2 // { dg-options "-O -fstrict-aliasing -ftree-pre -fno-tree-fre -fno-tree-sra" }
3 // { dg-additional-options "-Wno-return-type" }
5 typedef __SIZE_TYPE__ size_t;
8 template < class _T1, class > struct pair
15 template < typename _Tp > class new_allocator
18 typedef size_t size_type;
19 typedef _Tp * pointer;
20 typedef _Tp const_pointer;
21 typedef _Tp & reference;
22 typedef const _Tp & const_reference;
23 template < typename _Tp1 > struct rebind
25 typedef new_allocator < _Tp1 > other;
31 template < typename _Tp > class allocator:
32 public __gnu_cxx::new_allocator < _Tp >
34 template < typename, typename, typename > struct binary_function;
35 template < typename _Tp > struct less:binary_function < _Tp, _Tp, bool >
43 template < typename Root > struct node
47 template < typename, typename > struct chain;
50 template < typename, int >struct chain_at_index_;
54 Hd, typename Tl > struct chain_at_index_ <chain < Hd, Tl >, 0 >
61 Hd, typename Tl, int i > struct chain_at_index_ <chain < Hd, Tl >, i >
63 typedef typename chain_at_index_ < Tl, i - 1 >::type type;
66 template < typename Typelist, int i > struct at_index
68 typedef typename Typelist::root root_type;
69 typedef detail::chain_at_index_ < root_type, i > index_type;
70 typedef typename index_type::type type;
72 template < typename T1, typename T2 > struct create2
74 typedef node < chain < T1, chain < T2, null_type > > >type;
82 template < typename _Tp, _Tp __v > struct integral_constant
84 static const _Tp value = __v;
86 typedef integral_constant < bool, false > false_type;
87 template < typename, typename > struct is_same:false_type
91 using std::tr1::is_same;
94 struct null_mapped_type;
98 template < typename, typename, typename > struct basic_tree_policy_base;
107 basic_tree_policy_base
108 <Const_Node_Iterator, Const_Node_Iterator, Allocator >
112 < typename, typename, typename, typename > struct null_tree_node_update;
113 template < typename Const_Node_Iterator, typename Node_Iterator, typename, typename Allocator > class tree_order_statistics_node_update:
114 detail::basic_tree_policy_base
115 < Const_Node_Iterator, Node_Iterator, Allocator >
118 typedef Allocator allocator_type;
119 typedef typename allocator_type::size_type size_type;
120 typedef size_type metadata_type;
121 typedef Const_Node_Iterator const_node_iterator;
122 typedef Node_Iterator node_iterator;
125 allocator_type::template
126 rebind < metadata_type >::other::reference metadata_reference;
127 void operator () (node_iterator, const_node_iterator) const;
142 tree_order_statistics_node_update
149 () (node_iterator node_it, const_node_iterator end_nd_it) const
151 node_iterator l_child_it;
153 l_rank = (l_child_it == end_nd_it) ? : l_child_it.get_metadata ();
154 node_iterator r_child_it = node_it.get_r_child ();
156 r_rank = (r_child_it == end_nd_it) ? : r_child_it.get_metadata ();
158 < metadata_reference > (node_it.get_metadata ()) = l_rank + r_rank;
162 template < typename, typename, typename, bool > struct value_type_base;
169 > struct value_type_base <Key, null_mapped_type, Allocator, false >
171 typedef Key value_type;
174 Allocator::template rebind < value_type >::other value_type_allocator;
175 typedef typename value_type_allocator::pointer pointer;
176 typedef typename value_type_allocator::const_pointer const_pointer;
177 typedef typename value_type_allocator::reference reference;
178 typedef typename value_type_allocator::const_reference const_reference;
185 Mapped, typename Alloc, bool Store_Extra > struct vt_base_selector
187 typedef value_type_base < Key, Mapped, Alloc, Store_Extra > type;
201 types_traits:vt_base_selector < Key, Mapped, Alloc, Store_Extra >::type
203 template < typename, class, class > struct dumconst_node_iterator;
212 Node_And_It_Traits, class Allocator > class bin_search_tree_no_data_
219 < typename Node_And_It_Traits::node >::other::pointer node_pointer;
223 < Key, Mapped, Allocator, false >::const_reference const_reference;
224 typedef typename Node_And_It_Traits::point_iterator point_iterator;
225 typedef typename Node_And_It_Traits::node_update node_update;
226 void rotate_right (node_pointer);
230 Node_Update_ > void apply_update (node_pointer, Node_Update_ *);
246 bin_search_tree_no_data_
250 Cmp_Fn, Node_And_It_Traits, Allocator >::rotate_right (node_pointer p_x)
252 node_pointer p_y = p_x->m_p_parent;
253 p_y->m_p_right = p_x;
254 apply_update (p_x, this);
255 apply_update (p_x->m_p_parent, (node_update *) this);
276 bin_search_tree_no_data_
282 Allocator >::apply_update (node_pointer p_nd, Node_Update_ *)
284 node_update ()((p_nd), ((0)));
289 template < typename Key, typename Mapped, typename Cmp_Fn, typename Node_And_It_Traits, typename Allocator > class rb_tree_no_data_:
290 bin_search_tree_no_data_
291 < Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator >
294 bin_search_tree_no_data_
295 < Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator > base_type;
296 typedef typename base_type::node_pointer node_pointer;
298 typedef typename base_type::const_reference const_reference;
299 typedef typename base_type::point_iterator point_iterator;
300 std::pair < point_iterator, bool > insert (const_reference);
301 void insert_fixup (node_pointer);
333 Cmp_Fn, Node_And_It_Traits, Allocator >::insert (const_reference)
335 std::pair < point_iterator, bool > ins_pair;
337 insert_fixup (ins_pair.first.m_p_nd);
359 Node_And_It_Traits, Allocator >::insert_fixup (node_pointer p_nd)
364 this->rotate_right (p_nd);
372 typename, typename, typename, typename > struct container_base_dispatch;
383 container_base_dispatch
384 <Key, null_mapped_type, rb_tree_tag, Policy_Tl, Alloc >
386 typedef __gnu_cxx::typelist::at_index < Policy_Tl, 0 > at0;
387 typedef typename at0::type at0t;
388 typedef __gnu_cxx::typelist::at_index < Policy_Tl, 1 > at1;
389 typedef typename at1::type at1t;
391 rb_tree_no_data_ < Key, null_mapped_type, at0t, at1t, Alloc > type;
400 typename, typename, bool, class > class bin_search_tree_const_it_
411 class Iterator, class Allocator > class bin_search_tree_const_node_it_
415 Allocator::template rebind < Node >::other::pointer node_pointer;
417 typedef typename Node::metadata_type metadata_type;
422 < metadata_type >::other::const_reference const_metadata_reference;
423 bin_search_tree_const_node_it_ (node_pointer p_nd):
426 const_metadata_reference get_metadata ()
428 return (m_p_nd->get_metadata ());
430 bin_search_tree_const_node_it_ ()
432 bin_search_tree_const_node_it_
433 < Node, Const_Iterator, Iterator, Allocator > get_r_child ()
435 return ((m_p_nd->m_p_right));
437 bool operator == (bin_search_tree_const_node_it_)
450 class, class > class, class, class > struct bin_search_tree_traits;
472 bin_search_tree_traits
473 <Key, null_mapped_type, Cmp_Fn, Node_Update, Node, Allocator >
476 types_traits < Key, null_mapped_type, Allocator, false > type_traits;
479 bin_search_tree_const_it_
488 type_traits::value_type,
490 type_traits::pointer,
492 type_traits::const_pointer,
494 type_traits::reference,
496 type_traits::const_reference, true, Allocator > const_point_iterator;
497 typedef const_point_iterator point_iterator;
499 bin_search_tree_const_node_it_
502 const_point_iterator, point_iterator, Allocator > const_node_iterator;
503 typedef const_node_iterator node_iterator;
506 < const_node_iterator, node_iterator, Cmp_Fn, Allocator > node_update;
508 template < typename Node_Update, bool > struct tree_metadata_helper
510 typedef typename Node_Update::metadata_type type;
527 class Node_Update, class Allocator > struct tree_node_metadata_selector
530 dumconst_node_iterator < Key, Data, Allocator > dumconst_node_it;
533 null_update = is_same < Node_Update < dumconst_node_it,
537 null_tree_node_update < dumconst_node_it,
549 dumconst_node_it, Cmp_Fn, Allocator >, null_update >::type type;
559 class, class, class > class, class, class > struct tree_traits;
560 template < typename Value_Type, class Metadata, class Allocator > struct rb_tree_node_
562 typedef Metadata metadata_type;
569 < Value_Type, Metadata, Allocator > >::other::pointer node_pointer;
573 rebind < metadata_type >::other::reference metadata_reference;
574 metadata_reference get_metadata ()
578 node_pointer m_p_right;
579 node_pointer m_p_parent;
580 metadata_type m_metadata;
610 >:bin_search_tree_traits
627 tree_node_metadata_selector
630 Mapped, Cmp_Fn, Node_Update, Allocator >::type, Allocator >, Allocator >
633 template < typename Key, typename Mapped, typename Tag, typename Policy_Tl, typename Allocator > class container_base:
635 detail::container_base_dispatch
636 < Key, Mapped, Tag, Policy_Tl, Allocator >::type
638 template < typename Key, typename Mapped, typename Tag, typename, typename Policy_Tl, typename Allocator > class basic_tree:
640 container_base < Key, Mapped, Tag, Policy_Tl, Allocator >
669 null_tree_node_update,
693 __gnu_cxx::typelist::create2
697 < Key, Mapped, Cmp_Fn, Node_Update, Tag, Allocator > >::type, Allocator >
701 using namespace __gnu_pbds;
707 less < int >, rb_tree_tag, tree_order_statistics_node_update > set_t;