The GrowVector
Class Template Reference
std::vector like container optimized for pushing elements to the back. More...
Declaration
Included Headers
Public Member Typedefs Index
template <class T> | |
using | iterator = Iterator< GrowVector, T > |
template <class T> | |
using | const_iterator = Iterator< const GrowVector, const T > |
Private Member Typedefs Index
template <class T> | |
using | ChunkPtr = std::unique_ptr< Chunk > |
Public Member Functions Index
template <class T> | |
iterator | begin () |
returns an iterator to the beginning More... | |
template <class T> | |
const_iterator | begin () const |
returns an iterator to the beginning More... | |
template <class T> | |
iterator | end () |
returns an iterator to the end More... | |
template <class T> | |
const_iterator | end () const |
returns an iterator to the end More... | |
template <class T> | |
size_t | size () const |
returns the number of elements More... | |
template <class T> | |
void | push_back (T &&t) |
adds an element to the end More... | |
template <class... Args> | |
void | emplace_back (Args &&...args) |
constructs an element in-place at the end More... | |
template <class T> | |
void | pop_back () |
removes the last element More... | |
template <class T> | |
T & | at (size_t i) |
access specified element More... | |
template <class T> | |
const T & | at (size_t i) const |
access specified element More... | |
template <class T> | |
T & | front () |
access the first element More... | |
template <class T> | |
const T & | front () const |
access the first element More... | |
template <class T> | |
T & | back () |
access the last element More... | |
template <class T> | |
const T & | back () const |
access the last element More... | |
template <class T> | |
bool | empty () const |
checks whether the container is empty More... | |
template <class T> | |
void | clear () |
clears the contents More... | |
Private Member Functions Index
template <class T> | |
void | make_room () |
Private Member Attributes Index
template <class T> | |
std::vector< ChunkPtr > | m_chunks |
Private Static Attributes Index
template <class T> | |
static const size_t | chunkBits = 4 |
template <class T> | |
static const size_t | chunkSize = 1 << chunkBits |
template <class T> | |
static const size_t | chunkMask = chunkSize-1 |
Description
std::vector like container optimized for pushing elements to the back.
It differs from std::vector in that it can grow without invalidating pointers to its members just like std::deque and std::list.
It differs from std::deque in that the value can be incomplete just like std::vector.
It differs from std::list in that it does not need to allocate each node separately and provides random access to its members.
It is implemented as a vector of chunks where each chunk is a fixed capacity vector of T.
Definition at line 39 of file growvector.h.
Public Member Typedefs
const_iterator
|
Definition at line 80 of file growvector.h.
iterator
|
Definition at line 79 of file growvector.h.
Private Member Typedefs
ChunkPtr
|
Definition at line 50 of file growvector.h.
Public Member Functions
at()
| inline |
access specified element
Definition at line 125 of file growvector.h.
References GrowVector< T >::chunkBits, GrowVector< T >::chunkMask and GrowVector< T >::m_chunks.
at()
| inline |
access specified element
Definition at line 127 of file growvector.h.
References GrowVector< T >::chunkBits, GrowVector< T >::chunkMask and GrowVector< T >::m_chunks.
back()
| inline |
access the last element
Definition at line 135 of file growvector.h.
Reference GrowVector< T >::m_chunks.
Referenced by DocPara::handleHtmlStartTag, DocParser::handleStyleEnter and DocParser::internalValidatingParseDoc.
back()
| inline |
access the last element
Definition at line 137 of file growvector.h.
Reference GrowVector< T >::m_chunks.
begin()
| inline |
returns an iterator to the beginning
Definition at line 83 of file growvector.h.
begin()
| inline |
returns an iterator to the beginning
Definition at line 85 of file growvector.h.
clear()
| inline |
clears the contents
Definition at line 143 of file growvector.h.
Reference GrowVector< T >::m_chunks.
Referenced by flattenParagraphs and DocNodeList::move_append.
emplace_back()
| inline |
constructs an element in-place at the end
Definition at line 108 of file growvector.h.
References GrowVector< T >::m_chunks and GrowVector< T >::make_room.
empty()
| inline |
checks whether the container is empty
Definition at line 140 of file growvector.h.
Reference GrowVector< T >::m_chunks.
Referenced by DocParser::defaultHandleToken, DocDiagramFileBase::hasCaption, DocImage::hasCaption, DocVhdlFlow::hasCaption, DocRef::hasLinkText, DocTitle::hasTitle, DocParser::internalValidatingParseDoc, DocPara::isEmpty, DocRoot::isEmpty, DocText::isEmpty, DocHtmlRow::isHeading, DocbookDocVisitor::operator(), DocbookDocVisitor::operator(), HtmlDocVisitor::operator(), PrintDocVisitor::operator(), XmlDocVisitor::operator(), DocParamSect::parse, DocSimpleSect::parse and DocSimpleSect::parseXml.
end()
| inline |
returns an iterator to the end
Definition at line 88 of file growvector.h.
Reference GrowVector< T >::size.
Referenced by DocPara::handleIncludeOperator.
end()
| inline |
returns an iterator to the end
Definition at line 90 of file growvector.h.
Reference GrowVector< T >::size.
front()
| inline |
access the first element
Definition at line 130 of file growvector.h.
Reference GrowVector< T >::m_chunks.
Referenced by DocHtmlTable::firstRow and DocbookDocVisitor::operator().
front()
| inline |
access the first element
Definition at line 132 of file growvector.h.
Reference GrowVector< T >::m_chunks.
pop_back()
| inline |
removes the last element
Definition at line 115 of file growvector.h.
Reference GrowVector< T >::m_chunks.
Referenced by DocPara::handleCommand, DocPara::handleFile, DocPara::handleHtmlStartTag, DocPara::handleXRefItem, DocParser::internalValidatingParseDoc, DocAutoListItem::parse, DocInternal::parse, DocRoot::parse and DocSection::parse.
push_back()
| inline |
adds an element to the end
Definition at line 100 of file growvector.h.
References GrowVector< T >::m_chunks and GrowVector< T >::make_room.
size()
| inline |
returns the number of elements
Definition at line 93 of file growvector.h.
References GrowVector< T >::chunkSize and GrowVector< T >::m_chunks.
Referenced by GrowVector< T >::end, GrowVector< T >::end, DocPara::handleIncludeOperator, DocHtmlRow::numCells and DocHtmlTable::numRows.
Private Member Functions
make_room()
| inline |
Definition at line 146 of file growvector.h.
References GrowVector< T >::chunkSize and GrowVector< T >::m_chunks.
Referenced by GrowVector< T >::emplace_back and GrowVector< T >::push_back.
Private Member Attributes
m_chunks
|
Definition at line 154 of file growvector.h.
Referenced by GrowVector< T >::at, GrowVector< T >::at, GrowVector< T >::back, GrowVector< T >::back, GrowVector< T >::clear, GrowVector< T >::emplace_back, GrowVector< T >::empty, GrowVector< T >::front, GrowVector< T >::front, GrowVector< T >::make_room, GrowVector< T >::pop_back, GrowVector< T >::push_back and GrowVector< T >::size.
Private Static Attributes
chunkBits
| static |
Definition at line 42 of file growvector.h.
Referenced by GrowVector< T >::at and GrowVector< T >::at.
chunkMask
| static |
Definition at line 44 of file growvector.h.
Referenced by GrowVector< T >::at and GrowVector< T >::at.
chunkSize
| static |
Definition at line 43 of file growvector.h.
Referenced by GrowVector< T >::Chunk::Chunk, GrowVector< T >::make_room and GrowVector< T >::size.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus by Doxygen 1.14.0.