Implement deduction guides for vector
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@332901 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -244,6 +244,10 @@ public:
|
||||
bool __invariants() const;
|
||||
};
|
||||
|
||||
template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
||||
vector(InputIterator, InputIterator, Allocator = Allocator())
|
||||
-> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
|
||||
|
||||
template <class Allocator> struct hash<std::vector<bool, Allocator>>;
|
||||
|
||||
template <class T, class Allocator> bool operator==(const vector<T,Allocator>& x, const vector<T,Allocator>& y);
|
||||
@@ -316,13 +320,14 @@ template <class _Tp, class _Allocator>
|
||||
class __vector_base
|
||||
: protected __vector_base_common<true>
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
public:
|
||||
typedef _Allocator allocator_type;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
@@ -492,8 +497,8 @@ public:
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
explicit vector(size_type __n, const allocator_type& __a);
|
||||
#endif
|
||||
vector(size_type __n, const_reference __x);
|
||||
vector(size_type __n, const_reference __x, const allocator_type& __a);
|
||||
vector(size_type __n, const value_type& __x);
|
||||
vector(size_type __n, const value_type& __x, const allocator_type& __a);
|
||||
template <class _InputIterator>
|
||||
vector(_InputIterator __first,
|
||||
typename enable_if<__is_input_iterator <_InputIterator>::value &&
|
||||
@@ -890,6 +895,22 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
vector(_InputIterator, _InputIterator)
|
||||
-> vector<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
|
||||
template<class _InputIterator,
|
||||
class _Alloc,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
vector(_InputIterator, _InputIterator, _Alloc)
|
||||
-> vector<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
|
||||
@@ -1099,7 +1120,7 @@ vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
@@ -1112,7 +1133,7 @@ vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const allocator_type& __a)
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
Reference in New Issue
Block a user