@@ -2738,9 +2738,7 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
27382738 if (__n)
27392739 {
27402740 __r.__begin_ =
2741- __r.__end_ =
2742- static_cast <result_type*>(
2743- _VSTD::__libcpp_allocate (__n * sizeof (result_type), _LIBCPP_ALIGNOF (result_type)));
2741+ __r.__end_ = allocator<result_type>().allocate (__n);
27442742 for (size_t __i = 0 ; __i != __n; ++__r.__end_ , ++__i)
27452743 ::new (__r.__end_ ) result_type (__expr_[__i]);
27462744 }
@@ -2757,8 +2755,7 @@ valarray<_Tp>::valarray(size_t __n)
27572755{
27582756 if (__n)
27592757 {
2760- __begin_ = __end_ = static_cast <value_type*>(
2761- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2758+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
27622759#ifndef _LIBCPP_NO_EXCEPTIONS
27632760 try
27642761 {
@@ -2792,8 +2789,7 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n)
27922789{
27932790 if (__n)
27942791 {
2795- __begin_ = __end_ = static_cast <value_type*>(
2796- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2792+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
27972793#ifndef _LIBCPP_NO_EXCEPTIONS
27982794 try
27992795 {
@@ -2818,8 +2814,7 @@ valarray<_Tp>::valarray(const valarray& __v)
28182814{
28192815 if (__v.size ())
28202816 {
2821- __begin_ = __end_ = static_cast <value_type*>(
2822- _VSTD::__libcpp_allocate (__v.size () * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2817+ __begin_ = __end_ = allocator<value_type>().allocate (__v.size ());
28232818#ifndef _LIBCPP_NO_EXCEPTIONS
28242819 try
28252820 {
@@ -2856,8 +2851,7 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il)
28562851 const size_t __n = __il.size ();
28572852 if (__n)
28582853 {
2859- __begin_ = __end_ = static_cast <value_type*>(
2860- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2854+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
28612855#ifndef _LIBCPP_NO_EXCEPTIONS
28622856 try
28632857 {
@@ -2886,8 +2880,7 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
28862880 const size_t __n = __sa.__size_ ;
28872881 if (__n)
28882882 {
2889- __begin_ = __end_ = static_cast <value_type*>(
2890- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2883+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
28912884#ifndef _LIBCPP_NO_EXCEPTIONS
28922885 try
28932886 {
@@ -2914,8 +2907,7 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
29142907 const size_t __n = __ga.__1d_ .size ();
29152908 if (__n)
29162909 {
2917- __begin_ = __end_ = static_cast <value_type*>(
2918- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2910+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
29192911#ifndef _LIBCPP_NO_EXCEPTIONS
29202912 try
29212913 {
@@ -2944,8 +2936,7 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
29442936 const size_t __n = __ma.__1d_ .size ();
29452937 if (__n)
29462938 {
2947- __begin_ = __end_ = static_cast <value_type*>(
2948- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2939+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
29492940#ifndef _LIBCPP_NO_EXCEPTIONS
29502941 try
29512942 {
@@ -2974,8 +2965,7 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
29742965 const size_t __n = __ia.__1d_ .size ();
29752966 if (__n)
29762967 {
2977- __begin_ = __end_ = static_cast <value_type*>(
2978- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
2968+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
29792969#ifndef _LIBCPP_NO_EXCEPTIONS
29802970 try
29812971 {
@@ -3011,8 +3001,7 @@ valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
30113001 if (size () != __n)
30123002 {
30133003 __clear (size ());
3014- __begin_ = static_cast <value_type*>(
3015- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3004+ __begin_ = allocator<value_type>().allocate (__n);
30163005 __end_ = __begin_ + __n;
30173006 _VSTD::uninitialized_copy (__f, __l, __begin_);
30183007 } else {
@@ -3265,10 +3254,7 @@ valarray<_Tp>::operator+() const
32653254 size_t __n = size ();
32663255 if (__n)
32673256 {
3268- __r.__begin_ =
3269- __r.__end_ =
3270- static_cast <value_type*>(
3271- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3257+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
32723258 for (const value_type* __p = __begin_; __n; ++__r.__end_ , ++__p, --__n)
32733259 ::new (__r.__end_ ) value_type (+*__p);
32743260 }
@@ -3283,10 +3269,7 @@ valarray<_Tp>::operator-() const
32833269 size_t __n = size ();
32843270 if (__n)
32853271 {
3286- __r.__begin_ =
3287- __r.__end_ =
3288- static_cast <value_type*>(
3289- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3272+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
32903273 for (const value_type* __p = __begin_; __n; ++__r.__end_ , ++__p, --__n)
32913274 ::new (__r.__end_ ) value_type (-*__p);
32923275 }
@@ -3301,10 +3284,7 @@ valarray<_Tp>::operator~() const
33013284 size_t __n = size ();
33023285 if (__n)
33033286 {
3304- __r.__begin_ =
3305- __r.__end_ =
3306- static_cast <value_type*>(
3307- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3287+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
33083288 for (const value_type* __p = __begin_; __n; ++__r.__end_ , ++__p, --__n)
33093289 ::new (__r.__end_ ) value_type (~*__p);
33103290 }
@@ -3319,9 +3299,7 @@ valarray<_Tp>::operator!() const
33193299 size_t __n = size ();
33203300 if (__n)
33213301 {
3322- __r.__begin_ =
3323- __r.__end_ =
3324- static_cast <bool *>(_VSTD::__libcpp_allocate (__n * sizeof (bool ), _LIBCPP_ALIGNOF (bool )));
3302+ __r.__begin_ = __r.__end_ = allocator<bool >().allocate (__n);
33253303 for (const value_type* __p = __begin_; __n; ++__r.__end_ , ++__p, --__n)
33263304 ::new (__r.__end_ ) bool (!*__p);
33273305 }
@@ -3639,10 +3617,7 @@ valarray<_Tp>::shift(int __i) const
36393617 size_t __n = size ();
36403618 if (__n)
36413619 {
3642- __r.__begin_ =
3643- __r.__end_ =
3644- static_cast <value_type*>(
3645- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3620+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
36463621 const value_type* __sb;
36473622 value_type* __tb;
36483623 value_type* __te;
@@ -3678,10 +3653,7 @@ valarray<_Tp>::cshift(int __i) const
36783653 size_t __n = size ();
36793654 if (__n)
36803655 {
3681- __r.__begin_ =
3682- __r.__end_ =
3683- static_cast <value_type*>(
3684- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3656+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
36853657 __i %= static_cast <int >(__n);
36863658 const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
36873659 for (const value_type* __s = __m; __s != __end_; ++__r.__end_ , ++__s)
@@ -3700,10 +3672,7 @@ valarray<_Tp>::apply(value_type __f(value_type)) const
37003672 size_t __n = size ();
37013673 if (__n)
37023674 {
3703- __r.__begin_ =
3704- __r.__end_ =
3705- static_cast <value_type*>(
3706- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3675+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
37073676 for (const value_type* __p = __begin_; __n; ++__r.__end_ , ++__p, --__n)
37083677 ::new (__r.__end_ ) value_type (__f (*__p));
37093678 }
@@ -3718,10 +3687,7 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const
37183687 size_t __n = size ();
37193688 if (__n)
37203689 {
3721- __r.__begin_ =
3722- __r.__end_ =
3723- static_cast <value_type*>(
3724- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3690+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate (__n);
37253691 for (const value_type* __p = __begin_; __n; ++__r.__end_ , ++__p, --__n)
37263692 ::new (__r.__end_ ) value_type (__f (*__p));
37273693 }
@@ -3736,7 +3702,7 @@ void valarray<_Tp>::__clear(size_t __capacity)
37363702 {
37373703 while (__end_ != __begin_)
37383704 (--__end_)->~value_type ();
3739- _VSTD::__libcpp_deallocate ( __begin_, __capacity * sizeof (value_type), _LIBCPP_ALIGNOF (value_type) );
3705+ allocator<value_type>(). deallocate ( __begin_, __capacity);
37403706 __begin_ = __end_ = nullptr ;
37413707 }
37423708}
@@ -3748,8 +3714,7 @@ valarray<_Tp>::resize(size_t __n, value_type __x)
37483714 __clear (size ());
37493715 if (__n)
37503716 {
3751- __begin_ = __end_ = static_cast <value_type*>(
3752- _VSTD::__libcpp_allocate (__n * sizeof (value_type), _LIBCPP_ALIGNOF (value_type)));
3717+ __begin_ = __end_ = allocator<value_type>().allocate (__n);
37533718#ifndef _LIBCPP_NO_EXCEPTIONS
37543719 try
37553720 {
0 commit comments