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))
175template <
class _Tp1,
class _Tp2>
178template <
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)
_STLP_INLINE_LOOP _InputIter const _Tp & __val
allocator< _Tp2 > &_STLP_CALL __stl_alloc_rebind(allocator< _Tp1 > &__a, const _Tp2 *)
bool _STLP_CALL operator!=(const allocator< _T1 > &, const allocator< _T2 > &) _STLP_NOTHROW
allocator< _Tp2 > _STLP_CALL __stl_alloc_create(const allocator< _Tp1 > &, const _Tp2 *)
__kernel_ptrdiff_t ptrdiff_t
#define _STLP_FUNCTION_TMPL_PARTIAL_ORDER
StackAllocator< _Other > other
StackAllocator(char *beg, char *end)
_Tp * allocate(size_type n, void *=0)
const _Tp * const_pointer
void destroy(pointer __p)
const_pointer address(const_reference __x) const
const _Tp & const_reference
ptrdiff_t difference_type
void construct(pointer __p, const_reference __val)
const State & getState() const
void swap(StackAllocator &other)
void deallocate(pointer p, size_type n)
size_type max_size() const
StackAllocator(StackAllocator< _OtherTp > const &other)
pointer address(reference __x) const
State(const State &other)
State(char *beg, char *end)
bool operator==(const TKeyDef &t1, const TKeyDef &t2)