1#ifndef DUNE_FEM_COMMON_STACKALLOCATOR_HH
2#define DUNE_FEM_COMMON_STACKALLOCATOR_HH
19 :
public std::stack< void * >
26 :
std::stack< void * >(),
27 objectSize_( other.objectSize_ )
32 if( objectSize_ != other.objectSize_ )
34 objectSize_ = other.objectSize_;
42 for( ; !empty(); pop() )
43 ::operator
delete( top() );
48 void resize ( std::size_t newSize ) {
clear(); objectSize_ = newSize; }
51 std::size_t objectSize_;
59 template<
class T,
class S = UninitializedObjectStack * >
96 if( !stack().empty() )
114 template<
class... Args >
118 new( p ) T( std::forward< Args >( args )... );
124 template<
class,
class >
127 const Stack &stack ()
const {
return *stack_; }
128 Stack &stack () {
return *stack_; }
Definition: bindguard.hh:11
Definition: stackallocator.hh:20
std::size_t objectSize() const
Definition: stackallocator.hh:46
UninitializedObjectStack & operator=(const UninitializedObjectStack &other)
Definition: stackallocator.hh:30
void resize(std::size_t newSize)
Definition: stackallocator.hh:48
void clear()
Definition: stackallocator.hh:40
UninitializedObjectStack(const UninitializedObjectStack &other)
Definition: stackallocator.hh:25
UninitializedObjectStack(std::size_t objectSize)
Definition: stackallocator.hh:21
~UninitializedObjectStack()
Definition: stackallocator.hh:38
Definition: stackallocator.hh:61
T value_type
Definition: stackallocator.hh:62
std::ptrdiff_t difference_type
Definition: stackallocator.hh:71
const_pointer address(const_reference x) const
Definition: stackallocator.hh:91
void deallocate(pointer p, size_type n)
Definition: stackallocator.hh:106
S StackPtr
Definition: stackallocator.hh:77
StackAllocator(StackAllocator &&other)
Definition: stackallocator.hh:88
const T & const_reference
Definition: stackallocator.hh:68
T & reference
Definition: stackallocator.hh:67
StackAllocator(StackAllocator< U, S > &&other)
Definition: stackallocator.hh:85
size_type max_size() const
Definition: stackallocator.hh:112
pointer allocate(size_type n, typename rebind< void >::other::const_pointer hint=nullptr)
Definition: stackallocator.hh:93
StackAllocator(const StackAllocator &other)
Definition: stackallocator.hh:87
StackAllocator(const StackAllocator< U, S > &other)
Definition: stackallocator.hh:82
std::size_t size_type
Definition: stackallocator.hh:70
const T * const_pointer
Definition: stackallocator.hh:65
UninitializedObjectStack Stack
Definition: stackallocator.hh:76
pointer address(reference x) const
Definition: stackallocator.hh:90
void construct(pointer p, Args &&... args)
Definition: stackallocator.hh:115
void destroy(pointer p)
Definition: stackallocator.hh:121
StackAllocator(StackPtr stack)
Definition: stackallocator.hh:79
T * pointer
Definition: stackallocator.hh:64
Definition: stackallocator.hh:74
StackAllocator< U, S > other
Definition: stackallocator.hh:74
std::ptrdiff_t difference_type
Definition: stackallocator.hh:143
std::size_t size_type
Definition: stackallocator.hh:142
UninitializedObjectStack Stack
Definition: stackallocator.hh:148
void * pointer
Definition: stackallocator.hh:139
const void * const_pointer
Definition: stackallocator.hh:140
void value_type
Definition: stackallocator.hh:137
StackAllocator< U, S > other
Definition: stackallocator.hh:146