alternative Standard Libary  0.29.8
std::standard_vector_storage< T, TAllocator > Template-Strukturreferenz

#include <vector.hpp>

+ Zusammengehörigkeiten von std::standard_vector_storage< T, TAllocator >:

Öffentliche Methoden

 standard_vector_storage (const TAllocator &allocator)
 
 standard_vector_storage (e_noinitialize)
 
void reallocate (base_vector::size_type newCapacity, base_vector::size_type oldSize)
 
void reallocate_discard_old (base_vector::size_type newCapacity)
 
void destroy (T *ptr, base_vector::size_type n)
 
void reset ()
 
bool invariant () const
 
void record_high_watermark ()
 

Öffentliche Attribute

T * m_begin
 
T * m_end
 
T * m_capacityEnd
 
TAllocator m_allocator
 

Ausführliche Beschreibung

template<typename T, class TAllocator>
struct std::standard_vector_storage< T, TAllocator >

Beschreibung der Konstruktoren und Destruktoren

◆ standard_vector_storage() [1/2]

template<typename T, class TAllocator>
std::standard_vector_storage< T, TAllocator >::standard_vector_storage ( const TAllocator &  allocator)
inlineexplicit
49  : m_begin(0), m_end(0), m_capacityEnd(0), m_allocator(allocator)
50  {
51  }
T * m_capacityEnd
Definition: vector.hpp:106
TAllocator m_allocator
Definition: vector.hpp:107
T * m_end
Definition: vector.hpp:105
T * m_begin
Definition: vector.hpp:104

◆ standard_vector_storage() [2/2]

template<typename T, class TAllocator>
std::standard_vector_storage< T, TAllocator >::standard_vector_storage ( e_noinitialize  )
inlineexplicit
53  {
54  }

Dokumentation der Elementfunktionen

◆ destroy()

template<typename T, class TAllocator>
void std::standard_vector_storage< T, TAllocator >::destroy ( T *  ptr,
base_vector::size_type  n 
)
inline
84  {
85  std::destruct_n(ptr, n);
86  m_allocator.deallocate(ptr, n * sizeof(T));
87  }
TAllocator m_allocator
Definition: vector.hpp:107
void destruct_n(T *first, size_t n)
Definition: algorithm.hpp:88

◆ invariant()

template<typename T, class TAllocator>
bool std::standard_vector_storage< T, TAllocator >::invariant ( ) const
inline
97  {
98  return m_end >= m_begin;
99  }
T * m_end
Definition: vector.hpp:105
T * m_begin
Definition: vector.hpp:104

◆ reallocate()

template<typename T, class TAllocator>
void std::standard_vector_storage< T, TAllocator >::reallocate ( base_vector::size_type  newCapacity,
base_vector::size_type  oldSize 
)
inline
57  {
58  T* newBegin = static_cast<T*>(m_allocator.allocate(newCapacity * sizeof(T)));
59  const base_vector::size_type newSize = oldSize < newCapacity ? oldSize : newCapacity;
60  // Copy old data if needed.
61  if (m_begin)
62  {
63  std::copy_construct_n(m_begin, newSize, newBegin);
64  destroy(m_begin, oldSize);
65  }
66  m_begin = newBegin;
67  m_end = m_begin + newSize;
68  m_capacityEnd = m_begin + newCapacity;
69  assert(invariant());
70  }
void copy_construct_n(T *first, size_t n, T *result)
Definition: algorithm.hpp:43
bool invariant() const
Definition: vector.hpp:96
T * m_capacityEnd
Definition: vector.hpp:106
void destroy(T *ptr, base_vector::size_type n)
Definition: vector.hpp:83
TAllocator m_allocator
Definition: vector.hpp:107
int size_type
Definition: vector.hpp:43
T * m_end
Definition: vector.hpp:105
T * m_begin
Definition: vector.hpp:104

◆ reallocate_discard_old()

template<typename T, class TAllocator>
void std::standard_vector_storage< T, TAllocator >::reallocate_discard_old ( base_vector::size_type  newCapacity)
inline
72  {
73  assert(newCapacity > base_vector::size_type(m_capacityEnd - m_begin));
74  T* newBegin = static_cast<T*>(m_allocator.allocate(newCapacity * sizeof(T)));
76  if (m_begin)
77  destroy(m_begin, currSize);
78  m_begin = newBegin;
79  m_end = m_begin + currSize;
80  m_capacityEnd = m_begin + newCapacity;
81  assert(invariant());
82  }
bool invariant() const
Definition: vector.hpp:96
T * m_capacityEnd
Definition: vector.hpp:106
void destroy(T *ptr, base_vector::size_type n)
Definition: vector.hpp:83
TAllocator m_allocator
Definition: vector.hpp:107
int size_type
Definition: vector.hpp:43
T * m_end
Definition: vector.hpp:105
T * m_begin
Definition: vector.hpp:104

◆ record_high_watermark()

template<typename T, class TAllocator>
void std::standard_vector_storage< T, TAllocator >::record_high_watermark ( )
inline
101  {
102  }

◆ reset()

template<typename T, class TAllocator>
void std::standard_vector_storage< T, TAllocator >::reset ( )
inline
89  {
90  if (m_begin)
91  m_allocator.deallocate(m_begin, (m_end - m_begin) * sizeof(T));
92 
93  m_begin = m_end = 0;
94  m_capacityEnd = 0;
95  }
T * m_capacityEnd
Definition: vector.hpp:106
TAllocator m_allocator
Definition: vector.hpp:107
T * m_end
Definition: vector.hpp:105
T * m_begin
Definition: vector.hpp:104

Dokumentation der Datenelemente

◆ m_allocator

template<typename T, class TAllocator>
TAllocator std::standard_vector_storage< T, TAllocator >::m_allocator

◆ m_begin

template<typename T, class TAllocator>
T* std::standard_vector_storage< T, TAllocator >::m_begin

◆ m_capacityEnd

template<typename T, class TAllocator>
T* std::standard_vector_storage< T, TAllocator >::m_capacityEnd

◆ m_end

template<typename T, class TAllocator>
T* std::standard_vector_storage< T, TAllocator >::m_end

Die Dokumentation für diese Struktur wurde erzeugt aufgrund der Datei: