Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool > Class Template Reference

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
class ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >

SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that are designed to work with non-trivial T's.

We approximate is_trivially_copyable with trivial move/copy construction and trivial destruction. While the standard doesn't specify that you're allowed copy these types with memcpy, there is no way for the type to observe this. This catches the important case of std::pair<POD, POD>, which is not trivially assignable.

Definition at line 330 of file RVec.hxx.

Public Types

using const_iterator = const T *
using const_pointer = const T *
using const_reference = const T &
using const_reverse_iterator = std::reverse_iterator<const_iterator>
using difference_type = ptrdiff_t
using iterator = T *
using pointer = T *
using reference = T &
using reverse_iterator = std::reverse_iterator<iterator>
using Size_T = int32_t
using size_type = size_t
using value_type = T

Public Member Functions

reference back ()
const_reference back () const
const_iterator begin () const noexcept
iterator begin () noexcept
size_t capacity () const noexcept
size_t capacity_in_bytes () const
const_iterator cbegin () const noexcept
const_iterator cend () const noexcept
const_reverse_iterator crbegin () const noexcept
const_reverse_iterator crend () const noexcept
const_pointer data () const noexcept
 Return a pointer to the vector's buffer, even if empty().
pointer data () noexcept
 Return a pointer to the vector's buffer, even if empty().
bool empty () const
const_iterator end () const noexcept
iterator end () noexcept
reference front ()
const_reference front () const
size_type max_size () const noexcept
void pop_back ()
void push_back (const T &Elt)
void push_back (T &&Elt)
const_reverse_iterator rbegin () const noexcept
reverse_iterator rbegin () noexcept
const_reverse_iterator rend () const noexcept
reverse_iterator rend () noexcept
void set_size (size_t N)
 Set the array size to N, which the current array must have enough capacity for.
size_t size () const
size_type size_in_bytes () const

Protected Member Functions

 SmallVectorTemplateBase (size_t Size)
void grow (size_t MinSize=0)
 Grow the allocated memory (without initializing new elements), doubling the size of the allocated memory.
void grow_pod (void *FirstEl, size_t MinSize, size_t TSize)
 This is an implementation of the grow() method which only works on POD-like data types and is out of line to reduce code duplication.
void grow_pod (size_t MinSize, size_t TSize)
bool isSmall () const
 Return true if this is a smallvector which has not had dynamic memory allocated for it.
bool Owns () const
 If false, the RVec is in "memory adoption" mode, i.e. it is acting as a view on a memory buffer it does not own.
void resetToSmall ()
 Put this vector in a state of being small.

Static Protected Member Functions

static void destroy_range (T *S, T *E)
static void report_at_maximum_capacity ()
 Report that this vector is already at maximum capacity.
static void report_size_overflow (size_t MinSize)
 Report that MinSize doesn't fit into this vector's size type.
static constexpr size_t SizeTypeMax ()
 The maximum value of the Size_T used.
template<typename It1, typename It2>
static void uninitialized_copy (It1 I, It1 E, It2 Dest)
 Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements as needed.
template<typename It1, typename It2>
static void uninitialized_move (It1 I, It1 E, It2 Dest)
 Move the range [I, E) into the uninitialized memory starting with "Dest", constructing elements as needed.

Protected Attributes

voidfBeginX
Size_T fCapacity
 Always >= -1. fCapacity == -1 indicates the RVec is in "memory adoption" mode.
Size_T fSize = 0
 Always >= 0.

Private Types

using Base = SmallVectorBase

Private Member Functions

voidgetFirstEl () const
 Find the address of the first element.

#include <ROOT/RVec.hxx>

Inheritance diagram for ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >:
ROOT::Internal::VecOps::SmallVectorTemplateCommon< T > ROOT::Internal::VecOps::SmallVectorBase ROOT::Detail::VecOps::RVecImpl< T > ROOT::VecOps::RVecN< T, Internal::VecOps::RVecInlineStorageSize< T >::value > ROOT::VecOps::RVecN< T, N > ROOT::VecOps::RVec< T > ROOT::VecOps::RVec< bool > ROOT::VecOps::RVec< char > ROOT::VecOps::RVec< double > ROOT::VecOps::RVec< float > ROOT::VecOps::RVec< int > ROOT::VecOps::RVec< long int > ROOT::VecOps::RVec< long long int > ROOT::VecOps::RVec< unsigned int > ROOT::VecOps::RVec< unsigned long int > ROOT::VecOps::RVec< unsigned long long int >

Member Typedef Documentation

◆ Base

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::Base = SmallVectorBase
privateinherited

Definition at line 209 of file RVec.hxx.

◆ const_iterator

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::const_iterator = const T *
inherited

Definition at line 246 of file RVec.hxx.

◆ const_pointer

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::const_pointer = const T *
inherited

Definition at line 254 of file RVec.hxx.

◆ const_reference

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::const_reference = const T &
inherited

Definition at line 252 of file RVec.hxx.

◆ const_reverse_iterator

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>
inherited

Definition at line 248 of file RVec.hxx.

◆ difference_type

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::difference_type = ptrdiff_t
inherited

Definition at line 243 of file RVec.hxx.

◆ iterator

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::iterator = T *
inherited

Definition at line 245 of file RVec.hxx.

◆ pointer

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::pointer = T *
inherited

Definition at line 253 of file RVec.hxx.

◆ reference

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::reference = T &
inherited

Definition at line 251 of file RVec.hxx.

◆ reverse_iterator

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::reverse_iterator = std::reverse_iterator<iterator>
inherited

Definition at line 249 of file RVec.hxx.

◆ Size_T

Definition at line 144 of file RVec.hxx.

◆ size_type

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::size_type = size_t
inherited

Definition at line 242 of file RVec.hxx.

◆ value_type

template<typename T>
using ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::value_type = T
inherited

Definition at line 244 of file RVec.hxx.

Constructor & Destructor Documentation

◆ SmallVectorTemplateBase()

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::SmallVectorTemplateBase ( size_t Size)
inlineprotected

Definition at line 332 of file RVec.hxx.

Member Function Documentation

◆ back() [1/2]

template<typename T>
reference ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::back ( )
inlineinherited

Definition at line 302 of file RVec.hxx.

◆ back() [2/2]

template<typename T>
const_reference ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::back ( ) const
inlineinherited

Definition at line 310 of file RVec.hxx.

◆ begin() [1/2]

template<typename T>
const_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::begin ( ) const
inlinenoexceptinherited

Definition at line 262 of file RVec.hxx.

◆ begin() [2/2]

template<typename T>
iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::begin ( )
inlinenoexceptinherited

Definition at line 261 of file RVec.hxx.

◆ capacity()

template<typename T>
size_t ROOT::Internal::VecOps::SmallVectorBase::capacity ( ) const
inlinenoexceptinherited

Definition at line 177 of file RVec.hxx.

◆ capacity_in_bytes()

template<typename T>
size_t ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::capacity_in_bytes ( ) const
inlineinherited

Definition at line 279 of file RVec.hxx.

◆ cbegin()

template<typename T>
const_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::cbegin ( ) const
inlinenoexceptinherited

Definition at line 263 of file RVec.hxx.

◆ cend()

template<typename T>
const_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::cend ( ) const
inlinenoexceptinherited

Definition at line 266 of file RVec.hxx.

◆ crbegin()

template<typename T>
const_reverse_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::crbegin ( ) const
inlinenoexceptinherited

Definition at line 271 of file RVec.hxx.

◆ crend()

template<typename T>
const_reverse_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::crend ( ) const
inlinenoexceptinherited

Definition at line 274 of file RVec.hxx.

◆ data() [1/2]

template<typename T>
const_pointer ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::data ( ) const
inlinenoexceptinherited

Return a pointer to the vector's buffer, even if empty().

Definition at line 284 of file RVec.hxx.

◆ data() [2/2]

template<typename T>
pointer ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::data ( )
inlinenoexceptinherited

Return a pointer to the vector's buffer, even if empty().

Definition at line 282 of file RVec.hxx.

◆ destroy_range()

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::destroy_range ( T * S,
T * E )
inlinestaticprotected

Definition at line 334 of file RVec.hxx.

◆ empty()

template<typename T>
bool ROOT::Internal::VecOps::SmallVectorBase::empty ( ) const
inlineinherited

Definition at line 179 of file RVec.hxx.

◆ end() [1/2]

template<typename T>
const_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::end ( ) const
inlinenoexceptinherited

Definition at line 265 of file RVec.hxx.

◆ end() [2/2]

template<typename T>
iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::end ( )
inlinenoexceptinherited

Definition at line 264 of file RVec.hxx.

◆ front() [1/2]

template<typename T>
reference ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::front ( )
inlineinherited

Definition at line 286 of file RVec.hxx.

◆ front() [2/2]

template<typename T>
const_reference ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::front ( ) const
inlineinherited

Definition at line 294 of file RVec.hxx.

◆ getFirstEl()

template<typename T>
void * ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::getFirstEl ( ) const
inlineprivateinherited

Find the address of the first element.

For this pointer math to be valid with small-size of 0 for T with lots of alignment, it's important that SmallVectorStorage is properly-aligned even for small-size of 0.

Definition at line 214 of file RVec.hxx.

◆ grow()

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::grow ( size_t MinSize = 0)
protected

Grow the allocated memory (without initializing new elements), doubling the size of the allocated memory.

Guarantees space for at least one more element, or MinSize more elements if specified.

◆ grow_pod() [1/2]

void ROOT::Internal::VecOps::SmallVectorBase::grow_pod ( void * FirstEl,
size_t MinSize,
size_t TSize )
protectedinherited

This is an implementation of the grow() method which only works on POD-like data types and is out of line to reduce code duplication.

This function will report a fatal error if it cannot increase capacity.

Definition at line 51 of file RVec.cxx.

◆ grow_pod() [2/2]

template<typename T>
void ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::grow_pod ( size_t MinSize,
size_t TSize )
inlineprotectedinherited

Definition at line 224 of file RVec.hxx.

◆ isSmall()

template<typename T>
bool ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::isSmall ( ) const
inlineprotectedinherited

Return true if this is a smallvector which has not had dynamic memory allocated for it.

Definition at line 228 of file RVec.hxx.

◆ max_size()

template<typename T>
size_type ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::max_size ( ) const
inlinenoexceptinherited

Definition at line 277 of file RVec.hxx.

◆ Owns()

bool ROOT::Internal::VecOps::SmallVectorBase::Owns ( ) const
inlineprotectedinherited

If false, the RVec is in "memory adoption" mode, i.e. it is acting as a view on a memory buffer it does not own.

Definition at line 173 of file RVec.hxx.

◆ pop_back()

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::pop_back ( )
inline

Definition at line 380 of file RVec.hxx.

◆ push_back() [1/2]

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::push_back ( const T & Elt)
inline

Definition at line 364 of file RVec.hxx.

◆ push_back() [2/2]

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::push_back ( T && Elt)
inline

Definition at line 372 of file RVec.hxx.

◆ rbegin() [1/2]

template<typename T>
const_reverse_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::rbegin ( ) const
inlinenoexceptinherited

Definition at line 270 of file RVec.hxx.

◆ rbegin() [2/2]

template<typename T>
reverse_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::rbegin ( )
inlinenoexceptinherited

Definition at line 269 of file RVec.hxx.

◆ rend() [1/2]

template<typename T>
const_reverse_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::rend ( ) const
inlinenoexceptinherited

Definition at line 273 of file RVec.hxx.

◆ rend() [2/2]

template<typename T>
reverse_iterator ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::rend ( )
inlinenoexceptinherited

Definition at line 272 of file RVec.hxx.

◆ report_at_maximum_capacity()

void ROOT::Internal::VecOps::SmallVectorBase::report_at_maximum_capacity ( )
staticprotectedinherited

Report that this vector is already at maximum capacity.

Throws std::length_error or calls report_fatal_error.

Definition at line 44 of file RVec.cxx.

◆ report_size_overflow()

void ROOT::Internal::VecOps::SmallVectorBase::report_size_overflow ( size_t MinSize)
staticprotectedinherited

Report that MinSize doesn't fit into this vector's size type.

Throws std::length_error or calls report_fatal_error.

Definition at line 37 of file RVec.cxx.

◆ resetToSmall()

template<typename T>
void ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::resetToSmall ( )
inlineprotectedinherited

Put this vector in a state of being small.

Definition at line 231 of file RVec.hxx.

◆ set_size()

void ROOT::Internal::VecOps::SmallVectorBase::set_size ( size_t N)
inlineinherited

Set the array size to N, which the current array must have enough capacity for.

This does not construct or destroy any elements in the vector.

Clients can use this in conjunction with capacity() to write past the end of the buffer when they know that more elements are available, and only update the size later. This avoids the cost of value initializing elements which will only be overwritten.

Definition at line 190 of file RVec.hxx.

◆ size()

template<typename T>
size_t ROOT::Internal::VecOps::SmallVectorBase::size ( ) const
inlineinherited

Definition at line 176 of file RVec.hxx.

◆ size_in_bytes()

template<typename T>
size_type ROOT::Internal::VecOps::SmallVectorTemplateCommon< T >::size_in_bytes ( ) const
inlineinherited

Definition at line 276 of file RVec.hxx.

◆ SizeTypeMax()

constexpr size_t ROOT::Internal::VecOps::SmallVectorBase::SizeTypeMax ( )
inlinestaticconstexprprotectedinherited

The maximum value of the Size_T used.

Definition at line 155 of file RVec.hxx.

◆ uninitialized_copy()

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
template<typename It1, typename It2>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::uninitialized_copy ( It1 I,
It1 E,
It2 Dest )
inlinestaticprotected

Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements as needed.

Definition at line 353 of file RVec.hxx.

◆ uninitialized_move()

template<typename T, bool = (std::is_trivially_copy_constructible<T>::value) && (std::is_trivially_move_constructible<T>::value) && std::is_trivially_destructible<T>::value>
template<typename It1, typename It2>
void ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool >::uninitialized_move ( It1 I,
It1 E,
It2 Dest )
inlinestaticprotected

Move the range [I, E) into the uninitialized memory starting with "Dest", constructing elements as needed.

Definition at line 345 of file RVec.hxx.

Member Data Documentation

◆ fBeginX

void* ROOT::Internal::VecOps::SmallVectorBase::fBeginX
protectedinherited

Definition at line 147 of file RVec.hxx.

◆ fCapacity

Size_T ROOT::Internal::VecOps::SmallVectorBase::fCapacity
protectedinherited

Always >= -1. fCapacity == -1 indicates the RVec is in "memory adoption" mode.

Definition at line 152 of file RVec.hxx.

◆ fSize

Size_T ROOT::Internal::VecOps::SmallVectorBase::fSize = 0
protectedinherited

Always >= 0.

Definition at line 150 of file RVec.hxx.


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