alternative Standard Libary  0.29.8
std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow > Template-Strukturreferenz

#include <fixed_vector.hpp>

+ Klassendiagramm für std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >:
+ Zusammengehörigkeiten von std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >:

Öffentliche Typen

typedef aligned_as< T >::res etype_t
 

Öffentliche Methoden

 fixed_vector_storage (const TAllocator &allocator)
 
 fixed_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)
 
bool invariant () const
 
void record_high_watermark ()
 
base_vector::size_type get_high_watermark () const
 

Öffentliche Attribute

T * m_begin
 
T * m_end
 
etype_t m_data [(TCapacity *sizeof(T))/sizeof(etype_t)]
 
T * m_capacityEnd
 
TAllocator m_allocator
 
base_vector::size_type m_max_size
 

Ausführliche Beschreibung

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
struct std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >

Dokumentation der benutzerdefinierten Datentypen

◆ etype_t

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
typedef aligned_as<T>::res std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::etype_t

Beschreibung der Konstruktoren und Destruktoren

◆ fixed_vector_storage() [1/2]

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::fixed_vector_storage ( const TAllocator &  allocator)
inlineexplicit
44  : m_begin((T*)&m_data[0]), m_end(m_begin), m_capacityEnd(m_begin + TCapacity), m_allocator(allocator) , m_max_size(0)
45  {
46  }
base_vector::size_type m_max_size
Definition: fixed_vector.hpp:116
T * m_capacityEnd
Definition: fixed_vector.hpp:114
TAllocator m_allocator
Definition: fixed_vector.hpp:115
etype_t m_data[(TCapacity *sizeof(T))/sizeof(etype_t)]
Definition: fixed_vector.hpp:113
T * m_begin
Definition: fixed_vector.hpp:111
T * m_end
Definition: fixed_vector.hpp:112

◆ fixed_vector_storage() [2/2]

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::fixed_vector_storage ( e_noinitialize  )
inlineexplicit
48  {
49  }

Dokumentation der Elementfunktionen

◆ destroy()

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
void std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::destroy ( T *  ptr,
base_vector::size_type  n 
)
inline
90  {
91  std::destruct_n(ptr, n);
92  if ((etype_t*)ptr != &m_data[0])
93  m_allocator.deallocate(ptr, n * sizeof(T));
94  }
aligned_as< T >::res etype_t
Definition: fixed_vector.hpp:110
TAllocator m_allocator
Definition: fixed_vector.hpp:115
etype_t m_data[(TCapacity *sizeof(T))/sizeof(etype_t)]
Definition: fixed_vector.hpp:113
void destruct_n(T *first, size_t n)
Definition: algorithm.hpp:88

◆ get_high_watermark()

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
base_vector::size_type std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::get_high_watermark ( ) const
inline
106  {
107  return m_max_size;
108  }
base_vector::size_type m_max_size
Definition: fixed_vector.hpp:116

◆ invariant()

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
bool std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::invariant ( ) const
inline
96  {
97  return m_end >= m_begin;
98  }
T * m_begin
Definition: fixed_vector.hpp:111
T * m_end
Definition: fixed_vector.hpp:112

◆ reallocate()

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
void std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::reallocate ( base_vector::size_type  newCapacity,
base_vector::size_type  oldSize 
)
inline
51  {
52  if (!TGrowOnOverflow)
53  {
54  assert(!"fixed_vector cannot grow");
55  }
56  T* newBegin = static_cast<T*>(m_allocator.allocate(newCapacity * sizeof(T)));
57  const base_vector::size_type newSize = oldSize < newCapacity ? oldSize : newCapacity;
58 
59  if (m_begin)
60  {
61  std::copy_construct_n(m_begin, newSize, newBegin);
62  destroy(m_begin, oldSize);
63  }
64  m_begin = newBegin;
65  m_end = m_begin + newSize;
66  m_capacityEnd = m_begin + newCapacity;
68  assert(invariant());
69  }
void copy_construct_n(T *first, size_t n, T *result)
Definition: algorithm.hpp:43
void destroy(T *ptr, base_vector::size_type n)
Definition: fixed_vector.hpp:89
T * m_capacityEnd
Definition: fixed_vector.hpp:114
TAllocator m_allocator
Definition: fixed_vector.hpp:115
int size_type
Definition: vector.hpp:43
void record_high_watermark()
Definition: fixed_vector.hpp:99
bool invariant() const
Definition: fixed_vector.hpp:95
T * m_begin
Definition: fixed_vector.hpp:111
T * m_end
Definition: fixed_vector.hpp:112

◆ reallocate_discard_old()

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
void std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::reallocate_discard_old ( base_vector::size_type  newCapacity)
inline
71  {
72  if (newCapacity > base_vector::size_type(m_capacityEnd - m_begin))
73  {
74  if (!TGrowOnOverflow)
75  {
76  assert(!"fixed_vector cannot grow");
77  }
78  T* newBegin = static_cast<T*>(m_allocator.allocate(newCapacity * sizeof(T)));
79  const base_vector::size_type currSize((size_t)(m_end - m_begin));
80  if (m_begin)
81  destroy(m_begin, currSize);
82  m_begin = newBegin;
83  m_end = m_begin + currSize;
85  m_capacityEnd = m_begin + newCapacity;
86  }
87  assert(invariant());
88  }
void destroy(T *ptr, base_vector::size_type n)
Definition: fixed_vector.hpp:89
T * m_capacityEnd
Definition: fixed_vector.hpp:114
TAllocator m_allocator
Definition: fixed_vector.hpp:115
int size_type
Definition: vector.hpp:43
void record_high_watermark()
Definition: fixed_vector.hpp:99
bool invariant() const
Definition: fixed_vector.hpp:95
T * m_begin
Definition: fixed_vector.hpp:111
T * m_end
Definition: fixed_vector.hpp:112

◆ record_high_watermark()

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
void std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::record_high_watermark ( )
inline
100  {
101  const base_vector::size_type curr_size((size_t)(m_end - m_begin));
102  if (curr_size > m_max_size)
103  m_max_size = curr_size;
104  }
base_vector::size_type m_max_size
Definition: fixed_vector.hpp:116
int size_type
Definition: vector.hpp:43
T * m_begin
Definition: fixed_vector.hpp:111
T * m_end
Definition: fixed_vector.hpp:112

Dokumentation der Datenelemente

◆ m_allocator

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
TAllocator std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::m_allocator

◆ m_begin

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
T* std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::m_begin

◆ m_capacityEnd

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
T* std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::m_capacityEnd

◆ m_data

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
etype_t std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::m_data[(TCapacity *sizeof(T))/sizeof(etype_t)]

◆ m_end

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
T* std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::m_end

◆ m_max_size

template<typename T, class TAllocator, int TCapacity, bool TGrowOnOverflow>
base_vector::size_type std::fixed_vector_storage< T, TAllocator, TCapacity, TGrowOnOverflow >::m_max_size

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