@@ -503,9 +503,6 @@ protected:
503
503
return pointer_traits<__begin_node_pointer>::pointer_to (const_cast <__begin_node&>(__before_begin_));
504
504
}
505
505
506
- _LIBCPP_HIDE_FROM_ABI __node_allocator& __alloc () _NOEXCEPT { return __alloc_; }
507
- _LIBCPP_HIDE_FROM_ABI const __node_allocator& __alloc () const _NOEXCEPT { return __alloc_; }
508
-
509
506
typedef __forward_list_iterator<__node_pointer> iterator;
510
507
typedef __forward_list_const_iterator<__node_pointer> const_iterator;
511
508
@@ -541,8 +538,7 @@ protected:
541
538
542
539
template <class ... _Args>
543
540
_LIBCPP_HIDE_FROM_ABI __node_pointer __create_node (__node_pointer __next, _Args&&... __args) {
544
- __node_allocator& __a = __alloc ();
545
- __allocation_guard<__node_allocator> __guard (__a, 1 );
541
+ __allocation_guard<__node_allocator> __guard (__alloc_, 1 );
546
542
// Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
547
543
// held inside the node, since we need to use the allocator's construct() method for that.
548
544
//
@@ -552,17 +548,16 @@ protected:
552
548
std::__construct_at (std::addressof (*__guard.__get ()), __next);
553
549
554
550
// Now construct the value_type using the allocator's construct() method.
555
- __node_traits::construct (__a , std::addressof (__guard.__get ()->__get_value ()), std::forward<_Args>(__args)...);
551
+ __node_traits::construct (__alloc_ , std::addressof (__guard.__get ()->__get_value ()), std::forward<_Args>(__args)...);
556
552
return __guard.__release_ptr ();
557
553
}
558
554
559
555
_LIBCPP_HIDE_FROM_ABI void __delete_node (__node_pointer __node) {
560
556
// For the same reason as above, we use the allocator's destroy() method for the value_type,
561
557
// but not for the node itself.
562
- __node_allocator& __a = __alloc ();
563
- __node_traits::destroy (__a, std::addressof (__node->__get_value ()));
558
+ __node_traits::destroy (__alloc_, std::addressof (__node->__get_value ()));
564
559
std::__destroy_at (std::addressof (*__node));
565
- __node_traits::deallocate (__a , __node, 1 );
560
+ __node_traits::deallocate (__alloc_ , __node, 1 );
566
561
}
567
562
568
563
public:
@@ -579,15 +574,15 @@ protected:
579
574
private:
580
575
_LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc (const __forward_list_base&, false_type) {}
581
576
_LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc (const __forward_list_base& __x, true_type) {
582
- if (__alloc () != __x.__alloc () )
577
+ if (__alloc_ != __x.__alloc_ )
583
578
clear ();
584
- __alloc () = __x.__alloc () ;
579
+ __alloc_ = __x.__alloc_ ;
585
580
}
586
581
587
582
_LIBCPP_HIDE_FROM_ABI void __move_assign_alloc (__forward_list_base&, false_type) _NOEXCEPT {}
588
583
_LIBCPP_HIDE_FROM_ABI void __move_assign_alloc (__forward_list_base& __x, true_type)
589
584
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
590
- __alloc () = std::move (__x.__alloc () );
585
+ __alloc_ = std::move (__x.__alloc_ );
591
586
}
592
587
};
593
588
@@ -603,7 +598,7 @@ inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base
603
598
template <class _Tp , class _Alloc >
604
599
inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, const allocator_type& __a)
605
600
: __before_begin_(__begin_node()), __alloc_(__node_allocator(__a)) {
606
- if (__alloc () == __x.__alloc () ) {
601
+ if (__alloc_ == __x.__alloc_ ) {
607
602
__before_begin ()->__next_ = __x.__before_begin ()->__next_ ;
608
603
__x.__before_begin ()->__next_ = nullptr ;
609
604
}
@@ -624,7 +619,7 @@ inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
624
619
_NOEXCEPT_ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)
625
620
#endif
626
621
{
627
- std::__swap_allocator (__alloc () , __x.__alloc () );
622
+ std::__swap_allocator (__alloc_ , __x.__alloc_ );
628
623
using std::swap;
629
624
swap (__before_begin ()->__next_ , __x.__before_begin ()->__next_ );
630
625
}
@@ -739,7 +734,7 @@ public:
739
734
740
735
_LIBCPP_HIDE_FROM_ABI void assign (size_type __n, const value_type& __v);
741
736
742
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator () const _NOEXCEPT { return allocator_type (__base::__alloc () ); }
737
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator () const _NOEXCEPT { return allocator_type (this -> __alloc_ ); }
743
738
744
739
_LIBCPP_HIDE_FROM_ABI iterator begin () _NOEXCEPT { return iterator (__base::__before_begin ()->__next_ ); }
745
740
_LIBCPP_HIDE_FROM_ABI const_iterator begin () const _NOEXCEPT {
@@ -765,7 +760,7 @@ public:
765
760
return __base::__before_begin ()->__next_ == nullptr ;
766
761
}
767
762
_LIBCPP_HIDE_FROM_ABI size_type max_size () const _NOEXCEPT {
768
- return std::min<size_type>(__node_traits::max_size (__base::__alloc () ), numeric_limits<difference_type>::max ());
763
+ return std::min<size_type>(__node_traits::max_size (this -> __alloc_ ), numeric_limits<difference_type>::max ());
769
764
}
770
765
771
766
_LIBCPP_HIDE_FROM_ABI reference front () { return __base::__before_begin ()->__next_ ->__get_value (); }
@@ -944,7 +939,7 @@ forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
944
939
945
940
template <class _Tp , class _Alloc >
946
941
forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x)
947
- : __base(__node_traits::select_on_container_copy_construction(__x.__alloc() )) {
942
+ : __base(__node_traits::select_on_container_copy_construction(__x.__alloc_ )) {
948
943
insert_after (cbefore_begin (), __x.begin (), __x.end ());
949
944
}
950
945
@@ -967,7 +962,7 @@ forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(const forward_li
967
962
template <class _Tp , class _Alloc >
968
963
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, const __type_identity_t <allocator_type>& __a)
969
964
: __base(std::move(__x), __a) {
970
- if (__base::__alloc () != __x.__alloc () ) {
965
+ if (this -> __alloc_ != __x.__alloc_ ) {
971
966
typedef move_iterator<iterator> _Ip;
972
967
insert_after (cbefore_begin (), _Ip (__x.begin ()), _Ip (__x.end ()));
973
968
}
@@ -994,7 +989,7 @@ void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
994
989
995
990
template <class _Tp , class _Alloc >
996
991
void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) {
997
- if (__base::__alloc () == __x.__alloc () )
992
+ if (this -> __alloc_ == __x.__alloc_ )
998
993
__move_assign (__x, true_type ());
999
994
else {
1000
995
typedef move_iterator<iterator> _Ip;
0 commit comments