1 // <forward_list> -*- C++ -*-
3 // Copyright (C) 2010-2017 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 /** @file debug/forward_list
26 * This file is a GNU debug extension to the Standard C++ Library.
29 #ifndef _GLIBCXX_DEBUG_FORWARD_LIST
30 #define _GLIBCXX_DEBUG_FORWARD_LIST 1
32 #pragma GCC system_header
34 #include <forward_list>
35 #include <debug/safe_sequence.h>
36 #include <debug/safe_container.h>
37 #include <debug/safe_iterator.h>
39 // Special validity check for forward_list ranges.
40 #define __glibcxx_check_valid_fl_range(_First,_Last,_Dist) \
41 _GLIBCXX_DEBUG_VERIFY(_First._M_valid_range(_Last, _Dist, false), \
42 _M_message(__gnu_debug::__msg_valid_range) \
43 ._M_iterator(_First, #_First) \
44 ._M_iterator(_Last, #_Last))
48 /// Special iterators swap and invalidation for forward_list because of the
49 /// before_begin iterator.
50 template<typename _SafeSequence>
51 class _Safe_forward_list
52 : public _Safe_sequence<_SafeSequence>
56 { return *static_cast<_SafeSequence*>(this); }
59 _M_swap_aux(_Safe_sequence_base& __lhs,
60 _Safe_iterator_base*& __lhs_iterators,
61 _Safe_sequence_base& __rhs,
62 _Safe_iterator_base*& __rhs_iterators);
64 void _M_swap_single(_Safe_sequence_base&) noexcept;
70 using _Base_const_iterator = __decltype(_M_this()._M_base().cend());
71 this->_M_invalidate_if([this](_Base_const_iterator __it)
73 return __it != _M_this()._M_base().cbefore_begin()
74 && __it != _M_this()._M_base().cend(); });
77 void _M_swap(_Safe_sequence_base&) noexcept;
80 template<typename _SafeSequence>
82 _Safe_forward_list<_SafeSequence>::
83 _M_swap_aux(_Safe_sequence_base& __lhs,
84 _Safe_iterator_base*& __lhs_iterators,
85 _Safe_sequence_base& __rhs,
86 _Safe_iterator_base*& __rhs_iterators)
88 using const_iterator = typename _SafeSequence::const_iterator;
89 _Safe_iterator_base* __bbegin_its = 0;
90 _Safe_iterator_base* __last_bbegin = 0;
91 _SafeSequence& __rseq = static_cast<_SafeSequence&>(__rhs);
93 for (_Safe_iterator_base* __iter = __lhs_iterators; __iter;)
95 // Even iterator is cast to const_iterator, not a problem.
96 _Safe_iterator_base* __victim_base = __iter;
97 const_iterator* __victim =
98 static_cast<const_iterator*>(__victim_base);
99 __iter = __iter->_M_next;
100 if (__victim->base() == __rseq._M_base().cbefore_begin())
102 __victim->_M_unlink();
103 if (__lhs_iterators == __victim_base)
104 __lhs_iterators = __victim_base->_M_next;
107 __victim_base->_M_next = __bbegin_its;
108 __bbegin_its->_M_prior = __victim_base;
111 __last_bbegin = __victim_base;
112 __bbegin_its = __victim_base;
115 __victim_base->_M_sequence = std::__addressof(__lhs);
122 __rhs_iterators->_M_prior = __last_bbegin;
123 __last_bbegin->_M_next = __rhs_iterators;
125 __rhs_iterators = __bbegin_its;
129 template<typename _SafeSequence>
131 _Safe_forward_list<_SafeSequence>::
132 _M_swap_single(_Safe_sequence_base& __other) noexcept
134 std::swap(_M_this()._M_iterators, __other._M_iterators);
135 std::swap(_M_this()._M_const_iterators, __other._M_const_iterators);
136 // Useless, always 1 on forward_list
137 //std::swap(_M_this()_M_version, __other._M_version);
138 _Safe_iterator_base* __this_its = _M_this()._M_iterators;
139 _M_swap_aux(__other, __other._M_iterators,
140 _M_this(), _M_this()._M_iterators);
141 _Safe_iterator_base* __this_const_its = _M_this()._M_const_iterators;
142 _M_swap_aux(__other, __other._M_const_iterators,
143 _M_this(), _M_this()._M_const_iterators);
144 _M_swap_aux(_M_this(), __this_its,
145 __other, __other._M_iterators);
146 _M_swap_aux(_M_this(), __this_const_its,
147 __other, __other._M_const_iterators);
150 /* Special forward_list _M_swap version that does not swap the
151 * before-begin ownership.*/
152 template<typename _SafeSequence>
154 _Safe_forward_list<_SafeSequence>::
155 _M_swap(_Safe_sequence_base& __other) noexcept
157 // We need to lock both sequences to swap
158 using namespace __gnu_cxx;
159 __mutex *__this_mutex = &_M_this()._M_get_mutex();
160 __mutex *__other_mutex =
161 &static_cast<_SafeSequence&>(__other)._M_get_mutex();
162 if (__this_mutex == __other_mutex)
164 __scoped_lock __lock(*__this_mutex);
165 _M_swap_single(__other);
169 __scoped_lock __l1(__this_mutex < __other_mutex
170 ? *__this_mutex : *__other_mutex);
171 __scoped_lock __l2(__this_mutex < __other_mutex
172 ? *__other_mutex : *__this_mutex);
173 _M_swap_single(__other);
178 namespace std _GLIBCXX_VISIBILITY(default)
182 /// Class std::forward_list with safety/checking/debug instrumentation.
183 template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
185 : public __gnu_debug::_Safe_container<
186 forward_list<_Tp, _Alloc>, _Alloc, __gnu_debug::_Safe_forward_list>,
187 public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc>
189 typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base;
190 typedef __gnu_debug::_Safe_container<
191 forward_list, _Alloc, __gnu_debug::_Safe_forward_list> _Safe;
193 typedef typename _Base::iterator _Base_iterator;
194 typedef typename _Base::const_iterator _Base_const_iterator;
197 typedef typename _Base::reference reference;
198 typedef typename _Base::const_reference const_reference;
200 typedef __gnu_debug::_Safe_iterator<
201 _Base_iterator, forward_list> iterator;
202 typedef __gnu_debug::_Safe_iterator<
203 _Base_const_iterator, forward_list> const_iterator;
205 typedef typename _Base::size_type size_type;
206 typedef typename _Base::difference_type difference_type;
208 typedef _Tp value_type;
209 typedef typename _Base::allocator_type allocator_type;
210 typedef typename _Base::pointer pointer;
211 typedef typename _Base::const_pointer const_pointer;
213 // 23.2.3.1 construct/copy/destroy:
215 forward_list() = default;
218 forward_list(const allocator_type& __al) noexcept
221 forward_list(const forward_list& __list, const allocator_type& __al)
222 : _Base(__list, __al)
225 forward_list(forward_list&& __list, const allocator_type& __al)
226 : _Safe(std::move(__list._M_safe()), __al),
227 _Base(std::move(__list._M_base()), __al)
231 forward_list(size_type __n, const allocator_type& __al = allocator_type())
235 forward_list(size_type __n, const _Tp& __value,
236 const allocator_type& __al = allocator_type())
237 : _Base(__n, __value, __al)
240 template<typename _InputIterator,
241 typename = std::_RequireInputIter<_InputIterator>>
242 forward_list(_InputIterator __first, _InputIterator __last,
243 const allocator_type& __al = allocator_type())
244 : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
246 __gnu_debug::__base(__last), __al)
249 forward_list(const forward_list&) = default;
251 forward_list(forward_list&&) = default;
253 forward_list(std::initializer_list<_Tp> __il,
254 const allocator_type& __al = allocator_type())
258 ~forward_list() = default;
261 operator=(const forward_list&) = default;
264 operator=(forward_list&&) = default;
267 operator=(std::initializer_list<_Tp> __il)
270 this->_M_invalidate_all();
274 template<typename _InputIterator,
275 typename = std::_RequireInputIter<_InputIterator>>
277 assign(_InputIterator __first, _InputIterator __last)
279 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
280 __glibcxx_check_valid_range2(__first, __last, __dist);
282 if (__dist.second >= __gnu_debug::__dp_sign)
283 _Base::assign(__gnu_debug::__unsafe(__first),
284 __gnu_debug::__unsafe(__last));
286 _Base::assign(__first, __last);
288 this->_M_invalidate_all();
292 assign(size_type __n, const _Tp& __val)
294 _Base::assign(__n, __val);
295 this->_M_invalidate_all();
299 assign(std::initializer_list<_Tp> __il)
302 this->_M_invalidate_all();
305 using _Base::get_allocator;
310 before_begin() noexcept
311 { return iterator(_Base::before_begin(), this); }
314 before_begin() const noexcept
315 { return const_iterator(_Base::before_begin(), this); }
319 { return iterator(_Base::begin(), this); }
322 begin() const noexcept
323 { return const_iterator(_Base::begin(), this); }
327 { return iterator(_Base::end(), this); }
331 { return const_iterator(_Base::end(), this); }
334 cbegin() const noexcept
335 { return const_iterator(_Base::cbegin(), this); }
338 cbefore_begin() const noexcept
339 { return const_iterator(_Base::cbefore_begin(), this); }
342 cend() const noexcept
343 { return const_iterator(_Base::cend(), this); }
346 using _Base::max_size;
353 __glibcxx_check_nonempty();
354 return _Base::front();
360 __glibcxx_check_nonempty();
361 return _Base::front();
366 using _Base::emplace_front;
367 using _Base::push_front;
372 __glibcxx_check_nonempty();
373 this->_M_invalidate_if([this](_Base_const_iterator __it)
374 { return __it == this->_M_base().cbegin(); });
378 template<typename... _Args>
380 emplace_after(const_iterator __pos, _Args&&... __args)
382 __glibcxx_check_insert_after(__pos);
383 return iterator(_Base::emplace_after(__pos.base(),
384 std::forward<_Args>(__args)...),
389 insert_after(const_iterator __pos, const _Tp& __val)
391 __glibcxx_check_insert_after(__pos);
392 return iterator(_Base::insert_after(__pos.base(), __val), this);
396 insert_after(const_iterator __pos, _Tp&& __val)
398 __glibcxx_check_insert_after(__pos);
399 return iterator(_Base::insert_after(__pos.base(), std::move(__val)),
404 insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
406 __glibcxx_check_insert_after(__pos);
407 return iterator(_Base::insert_after(__pos.base(), __n, __val),
411 template<typename _InputIterator,
412 typename = std::_RequireInputIter<_InputIterator>>
414 insert_after(const_iterator __pos,
415 _InputIterator __first, _InputIterator __last)
417 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
418 __glibcxx_check_insert_range_after(__pos, __first, __last, __dist);
420 if (__dist.second >= __gnu_debug::__dp_sign)
423 _Base::insert_after(__pos.base(),
424 __gnu_debug::__unsafe(__first),
425 __gnu_debug::__unsafe(__last)),
429 return { _Base::insert_after(__pos.base(), __first, __last), this };
433 insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
435 __glibcxx_check_insert_after(__pos);
436 return iterator(_Base::insert_after(__pos.base(), __il), this);
441 _M_erase_after(_Base_const_iterator __pos)
443 _Base_const_iterator __next = std::next(__pos);
444 this->_M_invalidate_if([__next](_Base_const_iterator __it)
445 { return __it == __next; });
446 return _Base::erase_after(__pos);
450 erase_after(const_iterator __pos)
452 __glibcxx_check_erase_after(__pos);
453 return iterator(_M_erase_after(__pos.base()), this);
457 erase_after(const_iterator __pos, const_iterator __last)
459 __glibcxx_check_erase_range_after(__pos, __last);
460 for (_Base_const_iterator __victim = std::next(__pos.base());
461 __victim != __last.base(); ++__victim)
463 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
464 _M_message(__gnu_debug::__msg_valid_range2)
465 ._M_sequence(*this, "this")
466 ._M_iterator(__pos, "pos")
467 ._M_iterator(__last, "last"));
468 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
469 { return __it == __victim; });
471 return iterator(_Base::erase_after(__pos.base(), __last.base()), this);
475 swap(forward_list& __list)
476 noexcept( noexcept(declval<_Base&>().swap(__list)) )
478 _Safe::_M_swap(__list);
483 resize(size_type __sz)
485 this->_M_detach_singular();
487 // if __sz < size(), invalidate all iterators in [begin+__sz, end()
488 _Base_iterator __victim = _Base::begin();
489 _Base_iterator __end = _Base::end();
490 for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
493 for (; __victim != __end; ++__victim)
495 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
496 { return __it == __victim; });
505 this->_M_revalidate_singular();
506 __throw_exception_again;
511 resize(size_type __sz, const value_type& __val)
513 this->_M_detach_singular();
515 // if __sz < size(), invalidate all iterators in [begin+__sz, end())
516 _Base_iterator __victim = _Base::begin();
517 _Base_iterator __end = _Base::end();
518 for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
521 for (; __victim != __end; ++__victim)
523 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
524 { return __it == __victim; });
529 _Base::resize(__sz, __val);
533 this->_M_revalidate_singular();
534 __throw_exception_again;
542 this->_M_invalidate_all();
545 // 23.2.3.5 forward_list operations:
547 splice_after(const_iterator __pos, forward_list&& __list)
549 __glibcxx_check_insert_after(__pos);
550 _GLIBCXX_DEBUG_VERIFY(std::__addressof(__list) != this,
551 _M_message(__gnu_debug::__msg_self_splice)
552 ._M_sequence(*this, "this"));
553 _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
554 _M_message(__gnu_debug::__msg_splice_alloc)
556 ._M_sequence(__list, "__list"));
557 this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it)
559 return __it != __list._M_base().cbefore_begin()
560 && __it != __list._M_base().end();
562 _Base::splice_after(__pos.base(), std::move(__list._M_base()));
566 splice_after(const_iterator __pos, forward_list& __list)
567 { splice_after(__pos, std::move(__list)); }
570 splice_after(const_iterator __pos, forward_list&& __list,
573 __glibcxx_check_insert_after(__pos);
574 _GLIBCXX_DEBUG_VERIFY(__i._M_before_dereferenceable(),
575 _M_message(__gnu_debug::__msg_splice_bad)
576 ._M_iterator(__i, "__i"));
577 _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(std::__addressof(__list)),
578 _M_message(__gnu_debug::__msg_splice_other)
579 ._M_iterator(__i, "__i")
580 ._M_sequence(__list, "__list"));
581 _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
582 _M_message(__gnu_debug::__msg_splice_alloc)
584 ._M_sequence(__list, "__list"));
586 // _GLIBCXX_RESOLVE_LIB_DEFECTS
587 // 250. splicing invalidates iterators
588 _Base_const_iterator __next = std::next(__i.base());
589 this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it)
590 { return __it == __next; });
591 _Base::splice_after(__pos.base(), std::move(__list._M_base()),
596 splice_after(const_iterator __pos, forward_list& __list,
598 { splice_after(__pos, std::move(__list), __i); }
601 splice_after(const_iterator __pos, forward_list&& __list,
602 const_iterator __before, const_iterator __last)
604 typename __gnu_debug::_Distance_traits<const_iterator>::__type __dist;
605 auto __listptr = std::__addressof(__list);
606 __glibcxx_check_insert_after(__pos);
607 __glibcxx_check_valid_fl_range(__before, __last, __dist);
608 _GLIBCXX_DEBUG_VERIFY(__before._M_attached_to(__listptr),
609 _M_message(__gnu_debug::__msg_splice_other)
610 ._M_sequence(__list, "list")
611 ._M_iterator(__before, "before"));
612 _GLIBCXX_DEBUG_VERIFY(__before._M_dereferenceable()
613 || __before._M_is_before_begin(),
614 _M_message(__gnu_debug::__msg_valid_range2)
615 ._M_sequence(__list, "list")
616 ._M_iterator(__before, "before")
617 ._M_iterator(__last, "last"));
618 _GLIBCXX_DEBUG_VERIFY(__before != __last,
619 _M_message(__gnu_debug::__msg_valid_range2)
620 ._M_sequence(__list, "list")
621 ._M_iterator(__before, "before")
622 ._M_iterator(__last, "last"));
623 _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
624 _M_message(__gnu_debug::__msg_splice_alloc)
626 ._M_sequence(__list, "__list"));
628 for (_Base_const_iterator __tmp = std::next(__before.base());
629 __tmp != __last.base(); ++__tmp)
631 _GLIBCXX_DEBUG_VERIFY(__tmp != __list._M_base().end(),
632 _M_message(__gnu_debug::__msg_valid_range2)
633 ._M_sequence(__list, "list")
634 ._M_iterator(__before, "before")
635 ._M_iterator(__last, "last"));
636 _GLIBCXX_DEBUG_VERIFY(__listptr != this || __tmp != __pos.base(),
637 _M_message(__gnu_debug::__msg_splice_overlap)
638 ._M_iterator(__tmp, "position")
639 ._M_iterator(__before, "before")
640 ._M_iterator(__last, "last"));
641 // _GLIBCXX_RESOLVE_LIB_DEFECTS
642 // 250. splicing invalidates iterators
643 this->_M_transfer_from_if(__list, [__tmp](_Base_const_iterator __it)
644 { return __it == __tmp; });
647 _Base::splice_after(__pos.base(), std::move(__list._M_base()),
648 __before.base(), __last.base());
652 splice_after(const_iterator __pos, forward_list& __list,
653 const_iterator __before, const_iterator __last)
654 { splice_after(__pos, std::move(__list), __before, __last); }
657 remove(const _Tp& __val)
659 _Base_iterator __x = _Base::before_begin();
660 _Base_iterator __old = __x++;
661 while (__x != _Base::end())
664 __x = _M_erase_after(__old);
670 template<typename _Pred>
672 remove_if(_Pred __pred)
674 _Base_iterator __x = _Base::before_begin();
675 _Base_iterator __old = __x++;
676 while (__x != _Base::end())
679 __x = _M_erase_after(__old);
688 _Base_iterator __first = _Base::begin();
689 _Base_iterator __last = _Base::end();
690 if (__first == __last)
692 _Base_iterator __next = std::next(__first);
693 while (__next != __last)
695 if (*__first == *__next)
696 __next = _M_erase_after(__first);
702 template<typename _BinPred>
704 unique(_BinPred __binary_pred)
706 _Base_iterator __first = _Base::begin();
707 _Base_iterator __last = _Base::end();
708 if (__first == __last)
710 _Base_iterator __next = std::next(__first);
711 while (__next != __last)
713 if (__binary_pred(*__first, *__next))
714 __next = _M_erase_after(__first);
721 merge(forward_list&& __list)
723 if (this != std::__addressof(__list))
725 __glibcxx_check_sorted(_Base::begin(), _Base::end());
726 __glibcxx_check_sorted(__list._M_base().begin(),
727 __list._M_base().end());
728 this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it)
730 return __it != __list._M_base().cbefore_begin()
731 && __it != __list._M_base().cend();
733 _Base::merge(std::move(__list._M_base()));
738 merge(forward_list& __list)
739 { merge(std::move(__list)); }
741 template<typename _Comp>
743 merge(forward_list&& __list, _Comp __comp)
745 if (this != std::__addressof(__list))
747 __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp);
748 __glibcxx_check_sorted_pred(__list._M_base().begin(),
749 __list._M_base().end(), __comp);
750 this->_M_transfer_from_if(__list,
751 [&__list](_Base_const_iterator __it)
753 return __it != __list._M_base().cbefore_begin()
754 && __it != __list._M_base().cend();
756 _Base::merge(std::move(__list._M_base()), __comp);
760 template<typename _Comp>
762 merge(forward_list& __list, _Comp __comp)
763 { merge(std::move(__list), __comp); }
766 using _Base::reverse;
769 _M_base() noexcept { return *this; }
772 _M_base() const noexcept { return *this; }
775 template<typename _Tp, typename _Alloc>
777 operator==(const forward_list<_Tp, _Alloc>& __lx,
778 const forward_list<_Tp, _Alloc>& __ly)
779 { return __lx._M_base() == __ly._M_base(); }
781 template<typename _Tp, typename _Alloc>
783 operator<(const forward_list<_Tp, _Alloc>& __lx,
784 const forward_list<_Tp, _Alloc>& __ly)
785 { return __lx._M_base() < __ly._M_base(); }
787 template<typename _Tp, typename _Alloc>
789 operator!=(const forward_list<_Tp, _Alloc>& __lx,
790 const forward_list<_Tp, _Alloc>& __ly)
791 { return !(__lx == __ly); }
793 /// Based on operator<
794 template<typename _Tp, typename _Alloc>
796 operator>(const forward_list<_Tp, _Alloc>& __lx,
797 const forward_list<_Tp, _Alloc>& __ly)
798 { return (__ly < __lx); }
800 /// Based on operator<
801 template<typename _Tp, typename _Alloc>
803 operator>=(const forward_list<_Tp, _Alloc>& __lx,
804 const forward_list<_Tp, _Alloc>& __ly)
805 { return !(__lx < __ly); }
807 /// Based on operator<
808 template<typename _Tp, typename _Alloc>
810 operator<=(const forward_list<_Tp, _Alloc>& __lx,
811 const forward_list<_Tp, _Alloc>& __ly)
812 { return !(__ly < __lx); }
814 /// See std::forward_list::swap().
815 template<typename _Tp, typename _Alloc>
817 swap(forward_list<_Tp, _Alloc>& __lx, forward_list<_Tp, _Alloc>& __ly)
818 noexcept(noexcept(__lx.swap(__ly)))
821 } // namespace __debug
824 namespace __gnu_debug
826 template<typename _Tp, typename _Alloc>
827 struct _BeforeBeginHelper<std::__debug::forward_list<_Tp, _Alloc> >
829 typedef std::__debug::forward_list<_Tp, _Alloc> _Sequence;
831 template<typename _Iterator>
833 _S_Is(const _Safe_iterator<_Iterator, _Sequence>& __it)
836 __it.base() == __it._M_get_sequence()->_M_base().before_begin();
839 template<typename _Iterator>
841 _S_Is_Beginnest(const _Safe_iterator<_Iterator, _Sequence>& __it)
842 { return _S_Is(__it); }
845 template<typename _Tp, typename _Alloc>
846 struct _Sequence_traits<std::__debug::forward_list<_Tp, _Alloc> >
848 typedef typename std::__debug::forward_list<_Tp, _Alloc>::iterator _It;
850 static typename _Distance_traits<_It>::__type
851 _S_size(const std::__debug::forward_list<_Tp, _Alloc>& __seq)
854 ? std::make_pair(0, __dp_exact) : std::make_pair(1, __dp_equality);
858 #ifndef _GLIBCXX_DEBUG_PEDANTIC
859 template<class _Tp, class _Alloc>
860 struct _Insert_range_from_self_is_safe<
861 std::__debug::forward_list<_Tp, _Alloc> >
862 { enum { __value = 1 }; };