88
99// UNSUPPORTED: libcpp-abi-no-compressed-pair-padding
1010
11- #include < cstddef>
1211#include < cstdint>
1312#include < deque>
14- #include < iterator>
15- #include < type_traits>
1613
1714#include " min_allocator.h"
1815#include " test_allocator.h"
@@ -23,107 +20,7 @@ class small_pointer {
2320 std::uint16_t offset;
2421
2522public:
26- using value_type = typename std::remove_cv<T>::type;
27- using difference_type = std::int16_t ;
28- using reference = T&;
29- using pointer = T*;
30- using iterator_category = std::random_access_iterator_tag;
31-
32- small_pointer () : offset() {}
33- small_pointer (std::nullptr_t ) : offset() {}
34-
35- template <class CT ,
36- typename std::enable_if<std::is_same<const T, CT>::value && !std::is_const<T>::value, int >::type = 0 >
37- operator small_pointer<CT>() const ;
38- template <
39- class Void ,
40- typename std::enable_if<std::is_same<Void, void >::value && std::is_convertible<T*, void *>::value, int >::type = 0 >
41- operator small_pointer<Void>() const ;
42- template <
43- class CVoid ,
44- typename std::enable_if<std::is_same<CVoid, const void >::value && std::is_convertible<T*, const void *>::value,
45- int >::type = 0 >
46- operator small_pointer<CVoid>() const ;
47-
48- explicit operator bool () const ;
49-
5023 T& operator *() const ;
51- T* operator ->() const ;
52- T& operator [](difference_type) const ;
53-
54- small_pointer& operator ++();
55- small_pointer operator ++(int );
56- small_pointer& operator --();
57- small_pointer operator --(int );
58- small_pointer& operator +=(difference_type);
59- small_pointer& operator -=(difference_type);
60-
61- friend small_pointer operator +(small_pointer, difference_type) { return small_pointer (); }
62- friend small_pointer operator +(difference_type, small_pointer) { return small_pointer (); }
63- friend small_pointer operator -(small_pointer, difference_type) { return small_pointer (); }
64- friend difference_type operator -(small_pointer, small_pointer) { return 0 ; }
65-
66- friend bool operator ==(small_pointer, small_pointer) { return true ; }
67- #if TEST_STD_VER < 20
68- friend bool operator !=(small_pointer, small_pointer) { return false ; }
69- #endif
70- friend bool operator <(small_pointer, small_pointer) { return false ; }
71- friend bool operator <=(small_pointer, small_pointer) { return true ; }
72- friend bool operator >(small_pointer, small_pointer) { return false ; }
73- friend bool operator >=(small_pointer, small_pointer) { return true ; }
74-
75- friend bool operator ==(small_pointer, std::nullptr_t ) { return true ; }
76- #if TEST_STD_VER < 20
77- friend bool operator ==(std::nullptr_t , small_pointer) { return true ; }
78- friend bool operator !=(small_pointer, std::nullptr_t ) { return false ; }
79- friend bool operator !=(std::nullptr_t , small_pointer) { return false ; }
80- #endif
81-
82- small_pointer pointer_to (T&);
83- };
84-
85- template <>
86- class small_pointer <const void > {
87- std::uint16_t offset;
88-
89- public:
90- small_pointer () : offset() {}
91- small_pointer (std::nullptr_t ) : offset() {}
92-
93- template <class CT , typename std::enable_if<std::is_convertible<CT*, const void *>::value, int >::type = 0 >
94- explicit operator small_pointer<CT>() const ;
95-
96- explicit operator bool () const ;
97-
98- friend bool operator ==(small_pointer, std::nullptr_t ) { return true ; }
99- #if TEST_STD_VER < 20
100- friend bool operator ==(std::nullptr_t , small_pointer) { return true ; }
101- friend bool operator !=(small_pointer, std::nullptr_t ) { return false ; }
102- friend bool operator !=(std::nullptr_t , small_pointer) { return false ; }
103- #endif
104- };
105-
106- template <>
107- class small_pointer <void *> {
108- std::uint16_t offset;
109-
110- public:
111- small_pointer () : offset() {}
112- small_pointer (std::nullptr_t ) : offset() {}
113-
114- operator small_pointer<const void >() const ;
115-
116- template <class T , typename std::enable_if<std::is_convertible<T*, void *>::value, int >::type = 0 >
117- explicit operator small_pointer<T>() const ;
118-
119- explicit operator bool () const ;
120-
121- friend bool operator ==(small_pointer, std::nullptr_t ) { return true ; }
122- #if TEST_STD_VER < 20
123- friend bool operator ==(std::nullptr_t , small_pointer) { return true ; }
124- friend bool operator !=(small_pointer, std::nullptr_t ) { return false ; }
125- friend bool operator !=(std::nullptr_t , small_pointer) { return false ; }
126- #endif
12724};
12825
12926template <class T >
@@ -139,8 +36,8 @@ class small_iter_allocator {
13936 template <class U >
14037 small_iter_allocator (small_iter_allocator<U>) TEST_NOEXCEPT {}
14138
142- pointer allocate (std::size_t n);
143- void deallocate (pointer p, std::size_t );
39+ T* allocate (std::size_t n);
40+ void deallocate (T* p, std::size_t );
14441
14542 friend bool operator ==(small_iter_allocator, small_iter_allocator) { return true ; }
14643 friend bool operator !=(small_iter_allocator, small_iter_allocator) { return false ; }
@@ -159,8 +56,8 @@ class final_small_iter_allocator final {
15956 template <class U >
16057 final_small_iter_allocator (final_small_iter_allocator<U>) TEST_NOEXCEPT {}
16158
162- pointer allocate (std::size_t n);
163- void deallocate (pointer p, std::size_t );
59+ T* allocate (std::size_t n);
60+ void deallocate (T* p, std::size_t );
16461
16562 friend bool operator ==(final_small_iter_allocator, final_small_iter_allocator) { return true ; }
16663 friend bool operator !=(final_small_iter_allocator, final_small_iter_allocator) { return false ; }
0 commit comments