2 // { dg-options "-fgnu-tm" }
4 typedef long int ptrdiff_t;
5 typedef long unsigned int size_t;
6 namespace std __attribute__ ((__visibility__ ("default")))
12 namespace std __attribute__ ((__visibility__ ("default")))
14 struct input_iterator_tag
17 struct output_iterator_tag
20 struct forward_iterator_tag:public input_iterator_tag
23 struct bidirectional_iterator_tag:public forward_iterator_tag
26 struct random_access_iterator_tag:public bidirectional_iterator_tag
29 template < typename _Category, typename _Tp, typename _Distance =
30 ptrdiff_t, typename _Pointer = _Tp *, typename _Reference =
31 _Tp & >struct iterator
33 typedef _Category iterator_category;
34 typedef _Tp value_type;
35 typedef _Distance difference_type;
36 typedef _Pointer pointer;
37 typedef _Reference reference;
39 template < typename _Iterator > struct iterator_traits
41 typedef typename _Iterator::iterator_category iterator_category;
42 typedef typename _Iterator::value_type value_type;
43 typedef typename _Iterator::difference_type difference_type;
44 typedef typename _Iterator::pointer pointer;
45 typedef typename _Iterator::reference reference;
47 template < typename _Tp > struct iterator_traits <_Tp * >
49 typedef random_access_iterator_tag iterator_category;
50 typedef _Tp value_type;
51 typedef ptrdiff_t difference_type;
53 typedef _Tp & reference;
55 template < typename _Tp > struct iterator_traits <const _Tp *>
57 typedef random_access_iterator_tag iterator_category;
58 typedef _Tp value_type;
59 typedef ptrdiff_t difference_type;
60 typedef const _Tp *pointer;
61 typedef const _Tp & reference;
63 template < typename _Iter > inline typename iterator_traits <
64 _Iter >::iterator_category __iterator_category (const _Iter &)
66 return typename iterator_traits < _Iter >::iterator_category ();
70 namespace std __attribute__ ((__visibility__ ("default")))
72 template < typename _Iterator > class reverse_iterator:public iterator < typename iterator_traits < _Iterator >::iterator_category,
73 typename iterator_traits < _Iterator >::value_type,
74 typename iterator_traits < _Iterator >::difference_type,
75 typename iterator_traits < _Iterator >::pointer,
76 typename iterator_traits < _Iterator >::reference >
78 protected:_Iterator current;
79 typedef iterator_traits < _Iterator > __traits_type;
80 public:typedef _Iterator iterator_type;
81 typedef typename __traits_type::difference_type difference_type;
82 typedef typename __traits_type::pointer pointer;
83 typedef typename __traits_type::reference reference;
84 reverse_iterator ():current ()
86 } explicit reverse_iterator (iterator_type __x):current (__x)
88 } reverse_iterator (const reverse_iterator & __x):current (__x.current)
90 } template < typename _Iter > reverse_iterator (const reverse_iterator <
95 } iterator_type base () const
99 reference operator* () const
101 _Iterator __tmp = current;
104 pointer operator-> () const
106 return &(operator* ());
108 reverse_iterator & operator++ ()
113 reverse_iterator operator++ (int)
115 reverse_iterator __tmp = *this;
119 reverse_iterator & operator-- ()
124 reverse_iterator operator-- (int)
126 reverse_iterator __tmp = *this;
130 reverse_iterator operator+ (difference_type __n) const
132 return reverse_iterator (current - __n);
134 reverse_iterator & operator+= (difference_type __n)
139 reverse_iterator operator- (difference_type __n) const
141 return reverse_iterator (current + __n);
143 reverse_iterator & operator-= (difference_type __n)
148 reference operator[] (difference_type __n) const
150 return *(*this + __n);
153 template < typename _Iterator >
154 inline bool operator== (const reverse_iterator < _Iterator > &__x,
155 const reverse_iterator < _Iterator > &__y)
157 return __x.base () == __y.base ();
159 template < typename _Iterator >
160 inline bool operator< (const reverse_iterator < _Iterator > &__x,
161 const reverse_iterator < _Iterator > &__y)
163 return __y.base () < __x.base ();
165 template < typename _Iterator >
166 inline bool operator!= (const reverse_iterator < _Iterator > &__x,
167 const reverse_iterator < _Iterator > &__y)
169 return !(__x == __y);
171 template < typename _Iterator >
172 inline bool operator> (const reverse_iterator < _Iterator > &__x,
173 const reverse_iterator < _Iterator > &__y)
177 template < typename _Iterator >
178 inline bool operator<= (const reverse_iterator < _Iterator > &__x,
179 const reverse_iterator < _Iterator > &__y)
183 template < typename _Iterator >
184 inline bool operator>= (const reverse_iterator < _Iterator > &__x,
185 const reverse_iterator < _Iterator > &__y)
189 template < typename _Iterator > inline typename reverse_iterator <
190 _Iterator >::difference_type operator- (const reverse_iterator <
192 const reverse_iterator <
195 return __y.base () - __x.base ();
197 template < typename _Iterator > inline reverse_iterator < _Iterator >
198 operator+ (typename reverse_iterator < _Iterator >::difference_type __n,
199 const reverse_iterator < _Iterator > &__x)
201 return reverse_iterator < _Iterator > (__x.base () - __n);
203 template < typename _IteratorL,
204 typename _IteratorR > inline bool operator== (const reverse_iterator <
206 const reverse_iterator <
209 return __x.base () == __y.base ();
211 template < typename _IteratorL,
212 typename _IteratorR > inline bool operator< (const reverse_iterator <
214 const reverse_iterator <
217 return __y.base () < __x.base ();
219 template < typename _IteratorL,
220 typename _IteratorR > inline bool operator!= (const reverse_iterator <
222 const reverse_iterator <
225 return !(__x == __y);
227 template < typename _IteratorL,
228 typename _IteratorR > inline bool operator> (const reverse_iterator <
230 const reverse_iterator <
235 template < typename _IteratorL,
236 typename _IteratorR > inline bool operator<= (const reverse_iterator <
238 const reverse_iterator <
243 template < typename _IteratorL,
244 typename _IteratorR > inline bool operator>= (const reverse_iterator <
246 const reverse_iterator <
251 template < typename _IteratorL,
252 typename _IteratorR > inline typename reverse_iterator <
253 _IteratorL >::difference_type operator- (const reverse_iterator <
255 const reverse_iterator <
258 return __y.base () - __x.base ();
260 template < typename _Container > class back_insert_iterator:public iterator < output_iterator_tag, void, void, void,
263 protected:_Container * container;
264 public:typedef _Container container_type;
265 explicit back_insert_iterator (_Container & __x):container (&__x)
267 } back_insert_iterator & operator= (typename _Container::
268 const_reference __value)
270 container->push_back (__value);
273 back_insert_iterator & operator* ()
277 back_insert_iterator & operator++ ()
281 back_insert_iterator operator++ (int)
286 template < typename _Container > inline back_insert_iterator < _Container >
287 back_inserter (_Container & __x)
289 return back_insert_iterator < _Container > (__x);
291 template < typename _Container > class front_insert_iterator:public iterator < output_iterator_tag, void, void, void,
294 protected:_Container * container;
295 public:typedef _Container container_type;
296 explicit front_insert_iterator (_Container & __x):container (&__x)
298 } front_insert_iterator & operator= (typename _Container::
299 const_reference __value)
301 container->push_front (__value);
304 front_insert_iterator & operator* ()
308 front_insert_iterator & operator++ ()
312 front_insert_iterator operator++ (int)
317 template < typename _Container > inline front_insert_iterator < _Container >
318 front_inserter (_Container & __x)
320 return front_insert_iterator < _Container > (__x);
322 template < typename _Container > class insert_iterator:public iterator < output_iterator_tag, void, void, void,
325 protected:_Container * container;
326 typename _Container::iterator iter;
327 public:typedef _Container container_type;
328 insert_iterator (_Container & __x,
329 typename _Container::iterator __i):container (&__x),
332 } insert_iterator & operator= (typename _Container::
333 const_reference __value)
335 iter = container->insert (iter, __value);
339 insert_iterator & operator* ()
343 insert_iterator & operator++ ()
347 insert_iterator & operator++ (int)
352 template < typename _Container,
353 typename _Iterator > inline insert_iterator < _Container >
354 inserter (_Container & __x, _Iterator __i)
356 return insert_iterator < _Container > (__x,
357 typename _Container::
362 namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
365 using std::ptrdiff_t;
366 template < typename _Tp > class new_allocator
368 public:typedef size_t size_type;
369 typedef ptrdiff_t difference_type;
370 typedef _Tp *pointer;
371 typedef const _Tp *const_pointer;
372 typedef _Tp & reference;
373 typedef const _Tp & const_reference;
374 typedef _Tp value_type;
375 template < typename _Tp1 > struct rebind
377 typedef new_allocator < _Tp1 > other;
379 new_allocator ()throw ()
381 } new_allocator (const new_allocator &) throw ()
383 } template < typename _Tp1 > new_allocator (const new_allocator < _Tp1 >
386 } ~new_allocator ()throw ()
388 } pointer address (reference __x) const
392 const_pointer address (const_reference __x) const
396 pointer allocate (size_type __n, const void * = 0)
398 return static_cast < _Tp * >(::operator new (__n * sizeof (_Tp)));
400 void deallocate (pointer __p, size_type)
402 ::operator delete (__p);
403 } size_type max_size () const throw ()
405 return size_t (-1) / sizeof (_Tp);
407 void construct (pointer __p, const _Tp & __val)
409 ::new ((void *) __p) _Tp (__val);
410 } void destroy (pointer __p)
414 template < typename _Tp > inline bool operator== (const new_allocator <
416 const new_allocator <
421 template < typename _Tp > inline bool operator!= (const new_allocator <
423 const new_allocator <
430 namespace std __attribute__ ((__visibility__ ("default")))
432 template < typename _Tp > class allocator;
433 template <> class allocator < void >
435 public:typedef size_t size_type;
436 typedef ptrdiff_t difference_type;
437 typedef void *pointer;
438 typedef const void *const_pointer;
439 typedef void value_type;
440 template < typename _Tp1 > struct rebind
442 typedef allocator < _Tp1 > other;
445 template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
448 public:typedef size_t size_type;
449 typedef ptrdiff_t difference_type;
450 typedef _Tp *pointer;
451 typedef const _Tp *const_pointer;
452 typedef _Tp & reference;
453 typedef const _Tp & const_reference;
454 typedef _Tp value_type;
455 template < typename _Tp1 > struct rebind
457 typedef allocator < _Tp1 > other;
461 } allocator (const allocator & __a) throw ():__gnu_cxx::new_allocator <
464 } template < typename _Tp1 > allocator (const allocator < _Tp1 >
467 } ~allocator ()throw ()
470 template < typename _T1,
471 typename _T2 > inline bool operator== (const allocator < _T1 > &,
472 const allocator < _T2 > &)
476 template < typename _Tp > inline bool operator== (const allocator < _Tp > &,
477 const allocator < _Tp > &)
481 template < typename _T1,
482 typename _T2 > inline bool operator!= (const allocator < _T1 > &,
483 const allocator < _T2 > &)
487 template < typename _Tp > inline bool operator!= (const allocator < _Tp > &,
488 const allocator < _Tp > &)
492 template < typename _Alloc, bool = __is_empty (_Alloc) > struct __alloc_swap
494 static void _S_do_it (_Alloc &, _Alloc &)
497 template < typename _Alloc > struct __alloc_swap <_Alloc, false >
499 static void _S_do_it (_Alloc & __one, _Alloc & __two)
505 template < typename _Alloc, bool = __is_empty (_Alloc) > struct __alloc_neq
507 static bool _S_do_it (const _Alloc &, const _Alloc &)
512 template < typename _Alloc > struct __alloc_neq <_Alloc, false >
514 static bool _S_do_it (const _Alloc & __one, const _Alloc & __two)
516 return __one != __two;
521 namespace std __attribute__ ((__visibility__ ("default")))
523 struct _List_node_base
525 _List_node_base *_M_next;
526 _List_node_base *_M_prev;
527 static void swap (_List_node_base & __x, _List_node_base & __y) throw ();
528 void _M_transfer (_List_node_base * const __first,
529 _List_node_base * const __last) throw ();
530 void _M_reverse () throw ();
531 void _M_hook (_List_node_base * const __position) throw ();
532 void _M_unhook () throw ();
534 template < typename _Tp > struct _List_node:public _List_node_base
538 template < typename _Tp > struct _List_iterator
540 typedef _List_iterator < _Tp > _Self;
541 typedef _List_node < _Tp > _Node;
542 typedef ptrdiff_t difference_type;
543 typedef std::bidirectional_iterator_tag iterator_category;
544 typedef _Tp value_type;
545 typedef _Tp *pointer;
546 typedef _Tp & reference;
547 _List_iterator ():_M_node ()
549 } explicit _List_iterator (_List_node_base * __x):_M_node (__x)
551 } reference operator* () const
553 return static_cast < _Node * >(_M_node)->_M_data;
555 pointer operator-> () const
557 return &static_cast < _Node * >(_M_node)->_M_data;
559 _Self & operator++ ()
561 _M_node = _M_node->_M_next;
564 _Self operator++ (int)
567 _M_node = _M_node->_M_next;
570 _Self & operator-- ()
572 _M_node = _M_node->_M_prev;
575 _Self operator-- (int)
578 _M_node = _M_node->_M_prev;
581 bool operator== (const _Self & __x) const
583 return _M_node == __x._M_node;
585 bool operator!= (const _Self & __x) const
587 return _M_node != __x._M_node;
589 _List_node_base *_M_node;
591 template < typename _Tp > struct _List_const_iterator
593 typedef _List_const_iterator < _Tp > _Self;
594 typedef const _List_node < _Tp > _Node;
595 typedef _List_iterator < _Tp > iterator;
596 typedef ptrdiff_t difference_type;
597 typedef std::bidirectional_iterator_tag iterator_category;
598 typedef _Tp value_type;
599 typedef const _Tp *pointer;
600 typedef const _Tp & reference;
601 _List_const_iterator ():_M_node ()
603 } explicit _List_const_iterator (const _List_node_base *
606 } _List_const_iterator (const iterator & __x):_M_node (__x._M_node)
608 } reference operator* () const
610 return static_cast < _Node * >(_M_node)->_M_data;
612 pointer operator-> () const
614 return &static_cast < _Node * >(_M_node)->_M_data;
616 _Self & operator++ ()
618 _M_node = _M_node->_M_next;
621 _Self operator++ (int)
624 _M_node = _M_node->_M_next;
627 _Self & operator-- ()
629 _M_node = _M_node->_M_prev;
632 _Self operator-- (int)
635 _M_node = _M_node->_M_prev;
638 bool operator== (const _Self & __x) const
640 return _M_node == __x._M_node;
642 bool operator!= (const _Self & __x) const
644 return _M_node != __x._M_node;
646 const _List_node_base *_M_node;
648 template < typename _Tp, typename _Alloc > class _List_base
650 protected:typedef typename _Alloc::template rebind < _List_node < _Tp >
651 >::other _Node_alloc_type;
652 typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
653 struct _List_impl:public _Node_alloc_type
655 _List_node_base _M_node;
656 _List_impl ():_Node_alloc_type (), _M_node ()
658 } _List_impl (const _Node_alloc_type & __a):_Node_alloc_type (__a),
663 _List_node < _Tp > *_M_get_node ()
665 return _M_impl._Node_alloc_type::allocate (1);
667 void _M_put_node (_List_node < _Tp > *__p)
669 _M_impl._Node_alloc_type::deallocate (__p, 1);
670 } public:typedef _Alloc allocator_type;
671 _Node_alloc_type & _M_get_Node_allocator ()
673 return *static_cast < _Node_alloc_type * >(&this->_M_impl);
675 const _Node_alloc_type & _M_get_Node_allocator () const
677 return *static_cast < const _Node_alloc_type *>(&this->_M_impl);
678 } _Tp_alloc_type _M_get_Tp_allocator () const
680 return _Tp_alloc_type (_M_get_Node_allocator ());
682 allocator_type get_allocator () const
684 return allocator_type (_M_get_Node_allocator ());
686 _List_base ():_M_impl ()
690 _List_base (const allocator_type & __a):_M_impl (__a)
699 this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
700 this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
702 template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class list:protected _List_base < _Tp,
706 typedef typename _Alloc::value_type _Alloc_value_type;
707 typedef _List_base < _Tp, _Alloc > _Base;
708 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
709 public:typedef _Tp value_type;
710 typedef typename _Tp_alloc_type::pointer pointer;
711 typedef typename _Tp_alloc_type::const_pointer const_pointer;
712 typedef typename _Tp_alloc_type::reference reference;
713 typedef typename _Tp_alloc_type::const_reference const_reference;
714 typedef _List_iterator < _Tp > iterator;
715 typedef _List_const_iterator < _Tp > const_iterator;
716 typedef std::reverse_iterator < const_iterator > const_reverse_iterator;
717 typedef std::reverse_iterator < iterator > reverse_iterator;
718 typedef size_t size_type;
719 typedef ptrdiff_t difference_type;
720 typedef _Alloc allocator_type;
721 protected:typedef _List_node < _Tp > _Node;
722 using _Base::_M_impl;
723 using _Base::_M_put_node;
724 using _Base::_M_get_node;
725 using _Base::_M_get_Tp_allocator;
726 using _Base::_M_get_Node_allocator;
727 public:iterator begin ()
729 return iterator (this->_M_impl._M_node._M_next);
731 const_iterator begin () const
733 return const_iterator (this->_M_impl._M_node._M_next);
737 return iterator (&this->_M_impl._M_node);
739 void remove (const _Tp & __value);
740 template < typename _Predicate > void remove_if (_Predicate);
741 void _M_erase (iterator __position)
743 __position._M_node->_M_unhook ();
744 _Node *__n = static_cast < _Node * >(__position._M_node);
745 _M_get_Tp_allocator ().destroy (&__n->_M_data);
747 } void _M_check_equal_allocators (list & __x)
749 if (std::__alloc_neq <
750 typename _Base::_Node_alloc_type >::
751 _S_do_it (_M_get_Node_allocator (), __x._M_get_Node_allocator ()));
756 namespace std __attribute__ ((__visibility__ ("default")))
758 template < typename _Tp, typename _Alloc > void list < _Tp,
759 _Alloc >::remove (const value_type & __value)
761 iterator __first = begin ();
762 iterator __last = end ();
763 iterator __extra = __last;
764 while (__first != __last)
766 iterator __next = __first;
768 if (*__first == __value)
770 if (&*__first != &__value)
777 if (__extra != __last)
788 public:__attribute__ ((transaction_callable)) void removeUnitFromInside (Unit *
790 std::list < Unit * >unitsInside;
793 Building::removeUnitFromInside (Unit * unit)
795 unitsInside.remove (unit);