Reverting an old optimization that conflicts with the new allocator model, and causes some test casees to compile that shouldn't.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@122830 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
93c382bf45
commit
04240d90ef
@ -98,11 +98,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||||
|
|
||||||
void __construct_at_end(size_type __n);
|
void __construct_at_end(size_type __n);
|
||||||
void __construct_at_end(size_type __n, false_type);
|
|
||||||
void __construct_at_end(size_type __n, true_type);
|
|
||||||
void __construct_at_end(size_type __n, const_reference __x);
|
void __construct_at_end(size_type __n, const_reference __x);
|
||||||
void __construct_at_end(size_type __n, const_reference __x, false_type);
|
|
||||||
void __construct_at_end(size_type __n, const_reference __x, true_type);
|
|
||||||
template <class _InputIter>
|
template <class _InputIter>
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
@ -192,16 +188,8 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
|
|||||||
// Precondition: size() + __n <= capacity()
|
// Precondition: size() + __n <= capacity()
|
||||||
// Postcondition: size() == size() + __n
|
// Postcondition: size() == size() + __n
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||||
{
|
|
||||||
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
void
|
|
||||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
|
||||||
{
|
{
|
||||||
__alloc_rr& __a = this->__alloc();
|
__alloc_rr& __a = this->__alloc();
|
||||||
do
|
do
|
||||||
@ -212,15 +200,6 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
|||||||
} while (__n > 0);
|
} while (__n > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
|
||||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
|
||||||
{
|
|
||||||
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
|
|
||||||
this->__end_ += __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy constructs __n objects starting at __end_ from __x
|
// Copy constructs __n objects starting at __end_ from __x
|
||||||
// throws if construction throws
|
// throws if construction throws
|
||||||
// Precondition: __n > 0
|
// Precondition: __n > 0
|
||||||
@ -228,17 +207,8 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
|||||||
// Postcondition: size() == old size() + __n
|
// Postcondition: size() == old size() + __n
|
||||||
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||||
{
|
|
||||||
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
|
|
||||||
is_trivially_copy_assignable<value_type>::value>());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
void
|
|
||||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
|
|
||||||
{
|
{
|
||||||
__alloc_rr& __a = this->__alloc();
|
__alloc_rr& __a = this->__alloc();
|
||||||
do
|
do
|
||||||
@ -249,15 +219,6 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
|
|||||||
} while (__n > 0);
|
} while (__n > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
|
||||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
|
|
||||||
{
|
|
||||||
_STD::fill_n(this->__end_, __n, __x);
|
|
||||||
this->__end_ += __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
template <class _InputIter>
|
template <class _InputIter>
|
||||||
typename enable_if
|
typename enable_if
|
||||||
|
@ -3641,10 +3641,6 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Tra
|
|||||||
__lhs.swap(__rhs);
|
__lhs.swap(__rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
|
||||||
struct __is_zero_default_constructible<basic_string<_CharT, _Traits, _Allocator> >
|
|
||||||
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
|
||||||
typedef basic_string<char16_t> u16string;
|
typedef basic_string<char16_t> u16string;
|
||||||
|
@ -2302,9 +2302,6 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_pod
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_TYPE_TRAITS
|
#endif // _LIBCPP_HAS_TYPE_TRAITS
|
||||||
|
|
||||||
template <class _Tp> struct __is_zero_default_constructible
|
|
||||||
: public integral_constant<bool, is_scalar<_Tp>::value || is_empty<_Tp>::value> {};
|
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
|
@ -624,14 +624,8 @@ private:
|
|||||||
void allocate(size_type __n);
|
void allocate(size_type __n);
|
||||||
void deallocate();
|
void deallocate();
|
||||||
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
|
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n);
|
void __construct_at_end(size_type __n);
|
||||||
void __construct_at_end(size_type __n, false_type);
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, true_type);
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __construct_at_end(size_type __n, const_reference __x);
|
void __construct_at_end(size_type __n, const_reference __x);
|
||||||
void __construct_at_end(size_type __n, const_reference __x, false_type);
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __construct_at_end(size_type __n, const_reference __x, true_type);
|
|
||||||
template <class _ForwardIterator>
|
template <class _ForwardIterator>
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
@ -741,16 +735,8 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
|
|||||||
// Precondition: size() + __n <= capacity()
|
// Precondition: size() + __n <= capacity()
|
||||||
// Postcondition: size() == size() + __n
|
// Postcondition: size() == size() + __n
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
void
|
||||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||||
{
|
|
||||||
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
void
|
|
||||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
|
||||||
{
|
{
|
||||||
allocator_type& __a = this->__alloc();
|
allocator_type& __a = this->__alloc();
|
||||||
do
|
do
|
||||||
@ -761,15 +747,6 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
|||||||
} while (__n > 0);
|
} while (__n > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
|
||||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
|
||||||
{
|
|
||||||
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
|
|
||||||
this->__end_ += __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy constructs __n objects starting at __end_ from __x
|
// Copy constructs __n objects starting at __end_ from __x
|
||||||
// throws if construction throws
|
// throws if construction throws
|
||||||
// Precondition: __n > 0
|
// Precondition: __n > 0
|
||||||
@ -780,14 +757,6 @@ template <class _Tp, class _Allocator>
|
|||||||
_LIBCPP_INLINE_VISIBILITY inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||||
{
|
|
||||||
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
|
|
||||||
is_trivially_copy_assignable<value_type>::value>());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
void
|
|
||||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
|
|
||||||
{
|
{
|
||||||
allocator_type& __a = this->__alloc();
|
allocator_type& __a = this->__alloc();
|
||||||
do
|
do
|
||||||
@ -798,15 +767,6 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x,
|
|||||||
} while (__n > 0);
|
} while (__n > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
void
|
|
||||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
|
|
||||||
{
|
|
||||||
_STD::fill_n(this->__end_, __n, __x);
|
|
||||||
this->__end_ += __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
template <class _ForwardIterator>
|
template <class _ForwardIterator>
|
||||||
typename enable_if
|
typename enable_if
|
||||||
@ -2764,10 +2724,6 @@ struct _LIBCPP_VISIBLE hash<vector<bool, _Allocator> >
|
|||||||
{return __vec.__hash_code();}
|
{return __vec.__hash_code();}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
struct __is_zero_default_constructible<vector<_Tp, _Allocator> >
|
|
||||||
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user