@@ -141,45 +141,46 @@ class __default_alloc_func;
141
141
142
142
template <class _Fp , class _Ap , class _Rp , class ... _ArgTypes>
143
143
class __alloc_func <_Fp, _Ap, _Rp(_ArgTypes...)> {
144
- __compressed_pair< _Fp, _Ap> __f_ ;
144
+ _LIBCPP_COMPRESSED_PAIR ( _Fp, __func_, _Ap, __alloc_) ;
145
145
146
146
public:
147
147
typedef _LIBCPP_NODEBUG _Fp _Target;
148
148
typedef _LIBCPP_NODEBUG _Ap _Alloc;
149
149
150
- _LIBCPP_HIDE_FROM_ABI const _Target& __target () const { return __f_. first () ; }
150
+ _LIBCPP_HIDE_FROM_ABI const _Target& __target () const { return __func_ ; }
151
151
152
152
// WIN32 APIs may define __allocator, so use __get_allocator instead.
153
- _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator () const { return __f_. second () ; }
153
+ _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator () const { return __alloc_ ; }
154
154
155
- _LIBCPP_HIDE_FROM_ABI explicit __alloc_func (_Target&& __f)
156
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple()) {}
155
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func (_Target&& __f) : __func_(std::move(__f)), __alloc_() {}
157
156
158
- _LIBCPP_HIDE_FROM_ABI explicit __alloc_func (const _Target& __f, const _Alloc& __a)
159
- : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(__a)) {}
157
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func (const _Target& __f, const _Alloc& __a) : __func_(__f), __alloc_(__a) {}
160
158
161
159
_LIBCPP_HIDE_FROM_ABI explicit __alloc_func (const _Target& __f, _Alloc&& __a)
162
- : __f_(piecewise_construct, std::forward_as_tuple( __f), std::forward_as_tuple (std::move(__a) )) {}
160
+ : __func_( __f), __alloc_ (std::move(__a)) {}
163
161
164
162
_LIBCPP_HIDE_FROM_ABI explicit __alloc_func (_Target&& __f, _Alloc&& __a)
165
- : __f_(piecewise_construct, std::forward_as_tuple(std:: move(__f)), std::forward_as_tuple (std::move(__a) )) {}
163
+ : __func_( std::move(__f)), __alloc_ (std::move(__a)) {}
166
164
167
165
_LIBCPP_HIDE_FROM_ABI _Rp operator ()(_ArgTypes&&... __arg) {
168
166
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
169
- return _Invoker::__call (__f_. first () , std::forward<_ArgTypes>(__arg)...);
167
+ return _Invoker::__call (__func_ , std::forward<_ArgTypes>(__arg)...);
170
168
}
171
169
172
170
_LIBCPP_HIDE_FROM_ABI __alloc_func* __clone () const {
173
171
typedef allocator_traits<_Alloc> __alloc_traits;
174
172
typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA;
175
- _AA __a (__f_. second () );
173
+ _AA __a (__alloc_ );
176
174
typedef __allocator_destructor<_AA> _Dp;
177
175
unique_ptr<__alloc_func, _Dp> __hold (__a.allocate (1 ), _Dp (__a, 1 ));
178
- ::new ((void *)__hold.get ()) __alloc_func (__f_. first () , _Alloc (__a));
176
+ ::new ((void *)__hold.get ()) __alloc_func (__func_ , _Alloc (__a));
179
177
return __hold.release ();
180
178
}
181
179
182
- _LIBCPP_HIDE_FROM_ABI void destroy () _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
180
+ _LIBCPP_HIDE_FROM_ABI void destroy () _NOEXCEPT {
181
+ __func_.~_Fp ();
182
+ __alloc_.~_Alloc ();
183
+ }
183
184
184
185
_LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete (__alloc_func* __f) {
185
186
typedef allocator_traits<_Alloc> __alloc_traits;
0 commit comments