| 1 |
template<typename _Ptr> struct pointer_traits; |
| 2 |
|
| 3 |
template<typename _Tp> |
| 4 |
struct pointer_traits<_Tp*> |
| 5 |
{ |
| 6 |
template<typename _Up> using rebind = _Up*; |
| 7 |
}; |
| 8 |
|
| 9 |
template<typename _Ptr, typename _Tp> |
| 10 |
using __ptr_rebind = typename pointer_traits<_Ptr>::template rebind<_Tp>; |
| 11 |
|
| 12 |
template<typename _Tp> |
| 13 |
struct allocator |
| 14 |
{ |
| 15 |
typedef _Tp value_type; |
| 16 |
typedef _Tp* pointer; |
| 17 |
}; |
| 18 |
|
| 19 |
template<typename _Alloc> struct allocator_traits; |
| 20 |
|
| 21 |
template<typename _Tp> |
| 22 |
struct allocator_traits<allocator<_Tp>> |
| 23 |
{ |
| 24 |
using pointer = _Tp*; |
| 25 |
template<typename _Up> |
| 26 |
using rebind_alloc = allocator<_Up>; |
| 27 |
}; |
| 28 |
|
| 29 |
template<typename _Alloc, typename = typename _Alloc::value_type> |
| 30 |
struct __alloc_traits |
| 31 |
: allocator_traits<_Alloc> |
| 32 |
{ |
| 33 |
typedef _Alloc allocator_type; |
| 34 |
typedef allocator_traits<_Alloc> _Base_type; |
| 35 |
template<typename _Tp> |
| 36 |
struct rebind |
| 37 |
{ |
| 38 |
typedef typename _Base_type::template rebind_alloc<_Tp> other; |
| 39 |
}; |
| 40 |
}; |
| 41 |
|
| 42 |
template<typename _Ref, typename _Ptr> |
| 43 |
struct _Deque_iterator |
| 44 |
{ |
| 45 |
template<typename _CvTp> |
| 46 |
using __iter = _Deque_iterator<_CvTp&, __ptr_rebind<_Ptr, _CvTp>>; |
| 47 |
|
| 48 |
typedef __ptr_rebind<_Ptr, long> _Elt_pointer; |
| 49 |
typedef __ptr_rebind<_Ptr, _Elt_pointer> _Map_pointer; |
| 50 |
}; |
| 51 |
|
| 52 |
template<typename _Alloc> |
| 53 |
struct _Deque_base |
| 54 |
{ |
| 55 |
typedef typename __alloc_traits<_Alloc>::template rebind<long>::other _Tp_alloc_type; |
| 56 |
|
| 57 |
typedef __alloc_traits<_Tp_alloc_type> _Alloc_traits; |
| 58 |
|
| 59 |
typedef typename _Alloc_traits::pointer _Ptr; |
| 60 |
|
| 61 |
typedef _Deque_iterator<long&, _Ptr> iterator; |
| 62 |
|
| 63 |
typedef typename iterator::_Map_pointer _Map_pointer; |
| 64 |
}; |
| 65 |
|
| 66 |
|
| 67 |
inline void stack () |
| 68 |
{ |
| 69 |
_Deque_base<allocator<long>> c; |
| 70 |
} |