v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::base::SmallVector< T, kSize, Allocator > Class Template Reference

#include <small-vector.h>

Collaboration diagram for v8::base::SmallVector< T, kSize, Allocator >:

Public Types

using value_type = T
 

Public Member Functions

 SmallVector ()=default
 
 SmallVector (const Allocator &allocator)
 
V8_INLINE SmallVector (size_t size, const Allocator &allocator=Allocator())
 
V8_INLINE SmallVector (size_t size, const T &initial_value, const Allocator &allocator=Allocator())
 
 SmallVector (const SmallVector &other) V8_NOEXCEPT
 
 SmallVector (const SmallVector &other, const Allocator &allocator) V8_NOEXCEPT
 
 SmallVector (SmallVector &&other) V8_NOEXCEPT
 
 SmallVector (SmallVector &&other, const Allocator &allocator) V8_NOEXCEPT
 
V8_INLINE SmallVector (std::initializer_list< T > init, const Allocator &allocator=Allocator())
 
V8_INLINE SmallVector (base::Vector< const T > init, const Allocator &allocator=Allocator())
 
 ~SmallVector ()
 
SmallVectoroperator= (const SmallVector &other) V8_NOEXCEPT
 
SmallVectoroperator= (SmallVector &&other) V8_NOEXCEPT
 
Tdata ()
 
const Tdata () const
 
Tbegin ()
 
const Tbegin () const
 
Tend ()
 
const Tend () const
 
auto rbegin ()
 
auto rbegin () const
 
auto rend ()
 
auto rend () const
 
size_t size () const
 
bool empty () const
 
size_t capacity () const
 
Tfront ()
 
const Tfront () const
 
Tback ()
 
const Tback () const
 
Tat (size_t index)
 
Toperator[] (size_t index)
 
const Tat (size_t index) const
 
const Toperator[] (size_t index) const
 
template<typename... Args>
void emplace_back (Args &&... args)
 
void push_back (T x)
 
void pop_back (size_t count=1)
 
Tinsert (T *pos, const T &value)
 
Tinsert (T *pos, size_t count, const T &value)
 
template<typename It >
Tinsert (T *pos, It begin, It end)
 
Tinsert (T *pos, std::initializer_list< T > values)
 
void erase (T *erase_start)
 
void resize (size_t new_size)
 
void resize (size_t new_size, const T &initial_value)
 
void reserve (size_t new_capacity)
 
void clear ()
 
Allocator get_allocator () const
 

Static Public Attributes

static constexpr size_t kInlineSize = kSize
 

Private Member Functions

V8_NOINLINE V8_PRESERVE_MOST void Grow ()
 
V8_NOINLINE V8_PRESERVE_MOST void Grow (size_t min_capacity)
 
TAllocateDynamicStorage (size_t number_of_elements)
 
V8_NOINLINE V8_PRESERVE_MOST void FreeStorage ()
 
void reset_to_inline_storage ()
 
bool is_big () const
 
Tinline_storage_begin ()
 
const Tinline_storage_begin () const
 

Private Attributes

V8_NO_UNIQUE_ADDRESS Allocator allocator_
 
Tbegin_ = inline_storage_begin()
 
Tend_ = begin_
 
Tend_of_storage_ = begin_ + kInlineSize
 
char inline_storage_ [sizeof(T) *kInlineSize]
 

Static Private Attributes

static constexpr bool kHasTrivialElement
 

Detailed Description

template<typename T, size_t kSize, typename Allocator = std::allocator<T>>
class v8::base::SmallVector< T, kSize, Allocator >

Definition at line 22 of file small-vector.h.

Member Typedef Documentation

◆ value_type

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
using v8::base::SmallVector< T, kSize, Allocator >::value_type = T

Definition at line 25 of file small-vector.h.

Constructor & Destructor Documentation

◆ SmallVector() [1/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( )
default

◆ SmallVector() [2/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( const Allocator & allocator)
inlineexplicit

Definition at line 28 of file small-vector.h.

◆ SmallVector() [3/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_INLINE v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( size_t size,
const Allocator & allocator = Allocator() )
inlineexplicit

Definition at line 29 of file small-vector.h.

Here is the call graph for this function:

◆ SmallVector() [4/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_INLINE v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( size_t size,
const T & initial_value,
const Allocator & allocator = Allocator() )
inlineexplicit

Definition at line 34 of file small-vector.h.

Here is the call graph for this function:

◆ SmallVector() [5/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( const SmallVector< T, kSize, Allocator > & other)
inline

Definition at line 39 of file small-vector.h.

◆ SmallVector() [6/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( const SmallVector< T, kSize, Allocator > & other,
const Allocator & allocator )
inline

Definition at line 43 of file small-vector.h.

◆ SmallVector() [7/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( SmallVector< T, kSize, Allocator > && other)
inline

Definition at line 47 of file small-vector.h.

◆ SmallVector() [8/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( SmallVector< T, kSize, Allocator > && other,
const Allocator & allocator )
inline

Definition at line 51 of file small-vector.h.

◆ SmallVector() [9/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_INLINE v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( std::initializer_list< T > init,
const Allocator & allocator = Allocator() )
inline

Definition at line 55 of file small-vector.h.

Here is the call graph for this function:

◆ SmallVector() [10/10]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_INLINE v8::base::SmallVector< T, kSize, Allocator >::SmallVector ( base::Vector< const T > init,
const Allocator & allocator = Allocator() )
inlineexplicit

Definition at line 63 of file small-vector.h.

Here is the call graph for this function:

◆ ~SmallVector()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
v8::base::SmallVector< T, kSize, Allocator >::~SmallVector ( )
inline

Definition at line 72 of file small-vector.h.

Here is the call graph for this function:

Member Function Documentation

◆ AllocateDynamicStorage()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::AllocateDynamicStorage ( size_t number_of_elements)
inlineprivate

Definition at line 298 of file small-vector.h.

Here is the caller graph for this function:

◆ at() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T & v8::base::SmallVector< T, kSize, Allocator >::at ( size_t index)
inline

Definition at line 166 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ at() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T & v8::base::SmallVector< T, kSize, Allocator >::at ( size_t index) const
inline

Definition at line 176 of file small-vector.h.

Here is the call graph for this function:

◆ back() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T & v8::base::SmallVector< T, kSize, Allocator >::back ( )
inline

Definition at line 157 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ back() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T & v8::base::SmallVector< T, kSize, Allocator >::back ( ) const
inline

Definition at line 161 of file small-vector.h.

Here is the call graph for this function:

◆ begin() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::begin ( )
inline

Definition at line 132 of file small-vector.h.

Here is the caller graph for this function:

◆ begin() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T * v8::base::SmallVector< T, kSize, Allocator >::begin ( ) const
inline

Definition at line 133 of file small-vector.h.

◆ capacity()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
size_t v8::base::SmallVector< T, kSize, Allocator >::capacity ( ) const
inline

Definition at line 146 of file small-vector.h.

Here is the caller graph for this function:

◆ clear()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::clear ( )
inline

Definition at line 270 of file small-vector.h.

Here is the caller graph for this function:

◆ data() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::data ( )
inline

Definition at line 129 of file small-vector.h.

Here is the caller graph for this function:

◆ data() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T * v8::base::SmallVector< T, kSize, Allocator >::data ( ) const
inline

Definition at line 130 of file small-vector.h.

◆ emplace_back()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
template<typename... Args>
void v8::base::SmallVector< T, kSize, Allocator >::emplace_back ( Args &&... args)
inline

Definition at line 184 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
bool v8::base::SmallVector< T, kSize, Allocator >::empty ( ) const
inline

Definition at line 145 of file small-vector.h.

Here is the caller graph for this function:

◆ end() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::end ( )
inline

Definition at line 135 of file small-vector.h.

Here is the caller graph for this function:

◆ end() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T * v8::base::SmallVector< T, kSize, Allocator >::end ( ) const
inline

Definition at line 136 of file small-vector.h.

◆ erase()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::erase ( T * erase_start)
inline

Definition at line 233 of file small-vector.h.

Here is the caller graph for this function:

◆ FreeStorage()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_NOINLINE V8_PRESERVE_MOST void v8::base::SmallVector< T, kSize, Allocator >::FreeStorage ( )
inlineprivate

Definition at line 302 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ front() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T & v8::base::SmallVector< T, kSize, Allocator >::front ( )
inline

Definition at line 148 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ front() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T & v8::base::SmallVector< T, kSize, Allocator >::front ( ) const
inline

Definition at line 152 of file small-vector.h.

Here is the call graph for this function:

◆ get_allocator()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
Allocator v8::base::SmallVector< T, kSize, Allocator >::get_allocator ( ) const
inline

Definition at line 275 of file small-vector.h.

Here is the caller graph for this function:

◆ Grow() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_NOINLINE V8_PRESERVE_MOST void v8::base::SmallVector< T, kSize, Allocator >::Grow ( )
inlineprivate

Definition at line 280 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Grow() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_NOINLINE V8_PRESERVE_MOST void v8::base::SmallVector< T, kSize, Allocator >::Grow ( size_t min_capacity)
inlineprivate

Definition at line 283 of file small-vector.h.

Here is the call graph for this function:

◆ inline_storage_begin() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::inline_storage_begin ( )
inlineprivate

Definition at line 320 of file small-vector.h.

Here is the caller graph for this function:

◆ inline_storage_begin() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T * v8::base::SmallVector< T, kSize, Allocator >::inline_storage_begin ( ) const
inlineprivate

Definition at line 321 of file small-vector.h.

◆ insert() [1/4]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::insert ( T * pos,
const T & value )
inline

Definition at line 199 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert() [2/4]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
template<typename It >
T * v8::base::SmallVector< T, kSize, Allocator >::insert ( T * pos,
It begin,
It end )
inline

Definition at line 215 of file small-vector.h.

Here is the call graph for this function:

◆ insert() [3/4]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::insert ( T * pos,
size_t count,
const T & value )
inline

Definition at line 202 of file small-vector.h.

Here is the call graph for this function:

◆ insert() [4/4]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T * v8::base::SmallVector< T, kSize, Allocator >::insert ( T * pos,
std::initializer_list< T > values )
inline

Definition at line 229 of file small-vector.h.

Here is the call graph for this function:

◆ is_big()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
bool v8::base::SmallVector< T, kSize, Allocator >::is_big ( ) const
inlineprivate

Definition at line 318 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
SmallVector & v8::base::SmallVector< T, kSize, Allocator >::operator= ( const SmallVector< T, kSize, Allocator > & other)
inline

Definition at line 74 of file small-vector.h.

Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
SmallVector & v8::base::SmallVector< T, kSize, Allocator >::operator= ( SmallVector< T, kSize, Allocator > && other)
inline

Definition at line 100 of file small-vector.h.

Here is the call graph for this function:

◆ operator[]() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T & v8::base::SmallVector< T, kSize, Allocator >::operator[] ( size_t index)
inline

Definition at line 171 of file small-vector.h.

Here is the call graph for this function:

◆ operator[]() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
const T & v8::base::SmallVector< T, kSize, Allocator >::operator[] ( size_t index) const
inline

Definition at line 181 of file small-vector.h.

Here is the call graph for this function:

◆ pop_back()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::pop_back ( size_t count = 1)
inline

Definition at line 193 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_back()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::push_back ( T x)
inline

Definition at line 191 of file small-vector.h.

Here is the call graph for this function:

◆ rbegin() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
auto v8::base::SmallVector< T, kSize, Allocator >::rbegin ( )
inline

Definition at line 138 of file small-vector.h.

Here is the caller graph for this function:

◆ rbegin() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
auto v8::base::SmallVector< T, kSize, Allocator >::rbegin ( ) const
inline

Definition at line 139 of file small-vector.h.

◆ rend() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
auto v8::base::SmallVector< T, kSize, Allocator >::rend ( )
inline

Definition at line 141 of file small-vector.h.

Here is the caller graph for this function:

◆ rend() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
auto v8::base::SmallVector< T, kSize, Allocator >::rend ( ) const
inline

Definition at line 142 of file small-vector.h.

◆ reserve()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::reserve ( size_t new_capacity)
inline

Definition at line 265 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_to_inline_storage()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::reset_to_inline_storage ( )
inlineprivate

Definition at line 309 of file small-vector.h.

Here is the call graph for this function:

◆ resize() [1/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::resize ( size_t new_size)
inline

Definition at line 241 of file small-vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize() [2/2]

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
void v8::base::SmallVector< T, kSize, Allocator >::resize ( size_t new_size,
const T & initial_value )
inline

Definition at line 254 of file small-vector.h.

Here is the call graph for this function:

◆ size()

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
size_t v8::base::SmallVector< T, kSize, Allocator >::size ( ) const
inline

Definition at line 144 of file small-vector.h.

Here is the caller graph for this function:

Member Data Documentation

◆ allocator_

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
V8_NO_UNIQUE_ADDRESS Allocator v8::base::SmallVector< T, kSize, Allocator >::allocator_
private

Definition at line 325 of file small-vector.h.

◆ begin_

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T* v8::base::SmallVector< T, kSize, Allocator >::begin_ = inline_storage_begin()
private

Definition at line 333 of file small-vector.h.

◆ end_

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T* v8::base::SmallVector< T, kSize, Allocator >::end_ = begin_
private

Definition at line 334 of file small-vector.h.

◆ end_of_storage_

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
T* v8::base::SmallVector< T, kSize, Allocator >::end_of_storage_ = begin_ + kInlineSize
private

Definition at line 335 of file small-vector.h.

◆ inline_storage_

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
char v8::base::SmallVector< T, kSize, Allocator >::inline_storage_[sizeof(T) *kInlineSize]
private

Definition at line 336 of file small-vector.h.

◆ kHasTrivialElement

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
bool v8::base::SmallVector< T, kSize, Allocator >::kHasTrivialElement
staticconstexprprivate
Initial value:
=
is_trivially_copyable<T>::value && is_trivially_destructible<T>::value
static constexpr bool value
Definition macros.h:264

Definition at line 338 of file small-vector.h.

◆ kInlineSize

template<typename T , size_t kSize, typename Allocator = std::allocator<T>>
size_t v8::base::SmallVector< T, kSize, Allocator >::kInlineSize = kSize
staticconstexpr

Definition at line 24 of file small-vector.h.


The documentation for this class was generated from the following file: