1 #ifndef STLPORT_UNIT_TEST_STACK_ALLOCATOR_H 2 #define STLPORT_UNIT_TEST_STACK_ALLOCATOR_H 6 #if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 12 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) 72 #if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) 73 template <
class _OtherTp>
81 #if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATE_CLASSES) 82 template <
class _Other>
92 ++(*m_state.m_sharedNbAlloc);
94 if (*m_state.m_sharedCur + (
n *
sizeof(_Tp)) < m_state.m_end) {
95 char *
ret = *m_state.m_sharedCur;
96 *m_state.m_sharedCur +=
n *
sizeof(_Tp);
97 return reinterpret_cast<_Tp*>(
ret);
99 #if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 100 throw __STD bad_alloc();
101 # if defined (__DMC__) 109 #if defined (STLPORT) && \ 110 defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) 113 _Tp* _M_allocate(size_type
n, size_type &new_n) {
123 --(*m_state.m_sharedNbAlloc);
125 if ((
char*)
p == (*m_state.m_sharedCur -
n *
sizeof(_Tp))) {
126 *m_state.m_sharedCur -=
n *
sizeof(_Tp);
129 if ((
char*)
p < m_state.m_beg || (
char*)
p >= m_state.m_end) {
131 *m_state.m_sharedOk =
false;
141 bool ok()
const {
return m_state.m_isOk && (m_state.m_nbAlloc == 0); }
143 m_state.m_cur = m_state.m_beg;
144 m_state.m_isOk =
true;
145 m_state.m_swaped =
false;
147 bool swaped()
const {
return m_state.m_swaped; }
150 m_state.m_swaped =
true;
151 other.m_state.m_swaped =
true;
153 #if defined (STLPORT) && \ 154 defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) 161 {
return m_state.m_beg ==
other.m_state.m_beg; }
164 {
return !(*
this ==
other); }
170 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) 174 # if defined (STLPORT) && (defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES)) 175 template <
class _Tp1,
class _Tp2>
178 template <
class _Tp1,
class _Tp2>
183 # if !defined (STLPORT) || defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) 187 # elif !defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) 200 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) 206 #endif //STLPORT_UNIT_TEST_STACK_ALLOCATOR_H State(char *beg, char *end)
allocator< _Tp2 > _STLP_CALL __stl_alloc_create(const allocator< _Tp1 > &, const _Tp2 *)
const _Tp * const_pointer
void swap(StackAllocator< _Tp > &__a, StackAllocator< _Tp > &__b)
const _Tp & const_reference
StackAllocator(char *beg, char *end)
void swap(StackAllocator &other)
allocator< _Tp2 > &_STLP_CALL __stl_alloc_rebind(allocator< _Tp1 > &__a, const _Tp2 *)
StackAllocator< _Other > other
const_pointer address(const_reference __x) const
bool operator !=(const SortClass &lhs, const SortClass &rhs)
State(const State &other)
size_type max_size() const
_STLP_INLINE_LOOP _InputIter const _Tp & __val
void destroy(pointer __p)
bool operator==(const TKeyDef &t1, const TKeyDef &t2)
pointer address(reference __x) const
__kernel_ptrdiff_t ptrdiff_t
_Tp * allocate(size_type n, void *=0)
ptrdiff_t difference_type
void construct(pointer __p, const_reference __val)
#define _STLP_FUNCTION_TMPL_PARTIAL_ORDER
void deallocate(pointer p, size_type n)
StackAllocator(StackAllocator< _OtherTp > const &other)
const State & getState() const