Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::RVec< T > Class Template Reference

template<typename T>
class ROOT::RVec< T >

A "std::vector"-like collection of values implementing handy operation to analyse them.

Python interface

The ROOT::RVec class has additional features in Python, which allow to adopt memory from Numpy arrays and vice versa. The purpose of these features is the copyless interfacing of Python and C++ using their most common data containers, Numpy arrays and RVec with a std::vector interface.

Conversion of RVecs to Numpy arrays

RVecs of fundamental types (int, float, ...) have in Python the __array_interface__ attribute attached. This information allows Numpy to adopt the memory of RVecs without copying the content. You can find further documentation regarding the Numpy array interface here. The following code example demonstrates the memory adoption mechanism using numpy.asarray.

rvec = ROOT.RVec('double')((1, 2, 3))
print(rvec) # { 1.0000000, 2.0000000, 3.0000000 }
npy = numpy.asarray(rvec)
print(npy) # [1. 2. 3.]
rvec[0] = 42
print(npy) # [42. 2. 3.]
A "std::vector"-like collection of values implementing handy operation to analyse them.
Definition RVec.hxx:1525

Conversion of Numpy arrays to RVecs

Data owned by Numpy arrays with fundamental types (int, float, ...) can be adopted by RVecs. To create an RVec from a Numpy array, ROOT offers the facility ROOT.VecOps.AsRVec, which performs a similar operation to numpy.asarray, but vice versa. A code example demonstrating the feature and the adoption of the data owned by the Numpy array is shown below.

npy = numpy.array([1.0, 2.0, 3.0])
print(npy) # [1. 2. 3.]
rvec = ROOT.VecOps.AsRVec(npy)
print(rvec) # { 1.0000000, 2.0000000, 3.0000000 }
npy[0] = 42
print(rvec) # { 42.000000, 2.0000000, 3.0000000 }

Template Parameters
TThe type of the contained objects

A RVec is a container designed to make analysis of values' collections fast and easy. Its storage is contiguous in memory and its interface is designed such to resemble to the one of the stl vector. In addition the interface features methods and external functions to ease the manipulation and analysis of the data in the RVec.

Note
ROOT::VecOps::RVec can also be spelled simply ROOT::RVec. Shorthand aliases such as ROOT::RVecI or ROOT::RVecD are also available as template instantiations of RVec of fundamental types. The full list of available aliases:
  • RVecB (bool)
  • RVecC (char)
  • RVecD (double)
  • RVecF (float)
  • RVecI (int)
  • RVecL (long)
  • RVecLL (long long)
  • RVecU (unsigned)
  • RVecUL (unsigned long)
  • RVecULL (unsigned long long)
RVec does not attempt to be exception safe. Exceptions thrown by element constructors during insertions, swaps or other operations will be propagated potentially leaving the RVec object in an invalid state.
RVec methods (e.g. at or size) follow the STL naming convention instead of the ROOT naming convention in order to make RVec a drop-in replacement for std::vector.

DOI

Table of Contents

Example

Suppose to have an event featuring a collection of muons with a certain pseudorapidity, momentum and charge, e.g.:

std::vector<short> mu_charge {1, 1, -1, -1, -1, 1, 1, -1};
std::vector<float> mu_pt {56, 45, 32, 24, 12, 8, 7, 6.2};
std::vector<float> mu_eta {3.1, -.2, -1.1, 1, 4.1, 1.6, 2.4, -.5};

Suppose you want to extract the transverse momenta of the muons satisfying certain criteria, for example consider only negatively charged muons with a pseudorapidity smaller or equal to 2 and with a transverse momentum greater than 10 GeV. Such a selection would require, among the other things, the management of an explicit loop, for example:

std::vector<float> goodMuons_pt;
const auto size = mu_charge.size();
for (size_t i=0; i < size; ++i) {
if (mu_pt[i] > 10 && abs(mu_eta[i]) <= 2. && mu_charge[i] == -1) {
goodMuons_pt.emplace_back(mu_pt[i]);
}
}
RVec< PromoteType< T > > abs(const RVec< T > &v)
Definition RVec.hxx:1828

These operations become straightforward with RVec - we just need to write what we mean:

auto goodMuons_pt = mu_pt[ (mu_pt > 10.f && abs(mu_eta) <= 2.f && mu_charge == -1) ]

Now the clean collection of transverse momenta can be used within the rest of the data analysis, for example to fill a histogram.

Arithmetic operations, logical operations and mathematical functions

Arithmetic operations on RVec instances can be performed: for example, they can be added, subtracted, multiplied.

RVec<double> v1 {1.,2.,3.,4.};
RVec<float> v2 {5.f,6.f,7.f,8.f};
auto v3 = v1+v2;
auto v4 = 3 * v1;

The supported operators are

  • +, -, *, /
  • +=, -=, *=, /=
  • <, >, ==, !=, <=, >=, &&, ||
  • ~, !
  • &, |, ^
  • &=, |=, ^=
  • <<=, >>=

The most common mathematical functions are supported. It is possible to invoke them passing RVecs as arguments.

  • abs, fdim, fmod, remainder
  • floor, ceil, trunc, round, lround, llround
  • exp, exp2, expm1
  • log, log10, log2, log1p
  • pow
  • sqrt, cbrt
  • sin, cos, tan, asin, acos, atan, atan2, hypot
  • sinh, cosh, tanh, asinh, acosh
  • erf, erfc
  • lgamma, tgamma

If the VDT library is available, the following functions can be invoked. Internally the calculations are vectorized:

  • fast_expf, fast_logf, fast_sinf, fast_cosf, fast_tanf, fast_asinf, fast_acosf, fast_atanf
  • fast_exp, fast_log, fast_sin, fast_cos, fast_tan, fast_asin, fast_acos, fast_atan

Owning and adopting memory

RVec has contiguous memory associated to it. It can own it or simply adopt it. In the latter case, it can be constructed with the address of the memory associated to it and its length. For example:

std::vector<int> myStlVec {1,2,3};
RVec<int> myRVec(myStlVec.data(), myStlVec.size());

In this case, the memory associated to myStlVec and myRVec is the same, myRVec simply "adopted it". If any method which implies a re-allocation is called, e.g. emplace_back or resize, the adopted memory is released and new one is allocated. The previous content is copied in the new memory and preserved.

Sorting and manipulation of indices

Sorting

RVec complies to the STL interfaces when it comes to iterations. As a result, standard algorithms can be used, for example sorting:

RVec<double> v{6., 4., 5.};
std::sort(v.begin(), v.end());

For convenience, helpers are provided too:

auto sorted_v = Sort(v);
auto reversed_v = Reverse(v);
RVec< T > Reverse(const RVec< T > &v)
Return copy of reversed vector.
Definition RVec.hxx:2477
RVec< T > Sort(const RVec< T > &v)
Return copy of RVec with elements sorted in ascending order.
Definition RVec.hxx:2498

Manipulation of indices

It is also possible to manipulated the RVecs acting on their indices. For example, the following syntax

RVecD v0 {9., 7., 8.};
auto v1 = Take(v0, {1, 2, 0});
RVec< T > Take(const RVec< T > &v, const RVec< typename RVec< T >::size_type > &i)
Return elements of a vector at given indices.
Definition RVec.hxx:2335
ROOT::VecOps::RVec< double > RVecD
Definition RVec.hxx:3790

will yield a new RVec<double> the content of which is the first, second and zeroth element of v0, i.e. {7., 8., 9.}.

The Argsort and StableArgsort helper extracts the indices which order the content of a RVec. For example, this snippet accomplishes in a more expressive way what we just achieved:

auto v1_indices = Argsort(v0); // The content of v1_indices is {1, 2, 0}.
v1 = Take(v0, v1_indices);
RVec< typename RVec< T >::size_type > Argsort(const RVec< T > &v)
Return an RVec of indices that sort the input RVec.
Definition RVec.hxx:2246

The Take utility allows to extract portions of the RVec. The content to be taken can be specified with an RVec of indices or an integer. If the integer is negative, elements will be picked starting from the end of the container:

RVecF vf {1.f, 2.f, 3.f, 4.f};
auto vf_1 = Take(vf, {1, 3}); // The content is {2.f, 4.f}
auto vf_2 = Take(vf, 2); // The content is {1.f, 2.f}
auto vf_3 = Take(vf, -3); // The content is {2.f, 3.f, 4.f}
ROOT::VecOps::RVec< float > RVecF
Definition RVec.hxx:3791

Usage in combination with RDataFrame

RDataFrame leverages internally RVecs. Suppose to have a dataset stored in a TTree which holds these columns (here we choose C arrays to represent the collections, they could be as well std::vector instances):

nPart "nPart/I" An integer representing the number of particles
px "px[nPart]/D" The C array of the particles' x component of the momentum
py "py[nPart]/D" The C array of the particles' y component of the momentum
E "E[nPart]/D" The C array of the particles' Energy

Suppose you'd like to plot in a histogram the transverse momenta of all particles for which the energy is greater than 200 MeV. The code required would just be:

RDataFrame d("mytree", "myfile.root");
auto cutPt = [](RVecD &pxs, RVecD &pys, RVecD &Es) {
auto all_pts = sqrt(pxs * pxs + pys * pys);
auto good_pts = all_pts[Es > 200.];
return good_pts;
};
auto hpt = d.Define("pt", cutPt, {"px", "py", "E"})
.Histo1D("pt");
hpt->Draw();
#define d(i)
Definition RSha256.hxx:102
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
Definition RVec.hxx:1843

And if you'd like to express your selection as a string:

RDataFrame d("mytree", "myfile.root");
auto hpt = d.Define("pt", "sqrt(pxs * pxs + pys * pys)[E>200]")
.Histo1D("pt");
hpt->Draw();

Definition at line 1525 of file RVec.hxx.

Public Types

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

Public Member Functions

 RVec ()
 RVec (const RVec &RHS)
template<unsigned N>
 RVec (const RVecN< T, N > &RHS)
 RVec (const std::vector< T > &RHS)
 RVec (Detail::VecOps::RVecImpl< T > &&RHS)
template<typename ItTy, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>::type>
 RVec (ItTy S, ItTy E)
 RVec (RVec &&RHS)
template<unsigned N>
 RVec (RVecN< T, N > &&RHS)
 RVec (size_t Size)
 RVec (size_t Size, const T &Value)
 RVec (std::initializer_list< T > IL)
 RVec (T *p, size_t n)
template<typename in_iter, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>::value>::type>
void append (in_iter in_start, in_iter in_end)
 Add the specified range to the end of the SmallVector.
void append (size_type NumInputs, const T &Elt)
 Append NumInputs copies of Elt to the end.
void append (std::initializer_list< T > IL)
template<typename in_iter, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>::value>::type>
void assign (in_iter in_start, in_iter in_end)
void assign (size_type NumElts, const T &Elt)
void assign (std::initializer_list< T > IL)
reference at (size_type pos)
const_reference at (size_type pos) const
value_type at (size_type pos, value_type fallback)
 No exception thrown. The user specifies the desired value in case the RVecN is shorter than pos.
value_type at (size_type pos, value_type fallback) const
 No exception thrown. The user specifies the desired value in case the RVecN is shorter than pos.
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
void clear ()
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().
template<typename... ArgTypes>
reference emplace_back (ArgTypes &&...Args)
bool empty () const
const_iterator end () const noexcept
iterator end () noexcept
iterator erase (const_iterator CI)
iterator erase (const_iterator CS, const_iterator CE)
reference front ()
const_reference front () const
iterator insert (iterator I, const T &Elt)
template<typename ItTy, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>::type>
iterator insert (iterator I, ItTy From, ItTy To)
iterator insert (iterator I, size_type NumToInsert, const T &Elt)
void insert (iterator I, std::initializer_list< T > IL)
iterator insert (iterator I, T &&Elt)
size_type max_size () const noexcept
template<typename U, typename = std::enable_if<std::is_convertible<T, U>::value>>
 operator RVec< U > () const
 operator RVecN< U, M > () const
RVecoperator= (const RVec &RHS)
RVecoperator= (RVec &&RHS)
template<typename V, typename = std::enable_if<std::is_convertible<V, bool>::value>>
RVec operator[] (const RVec< V > &conds) const
template<typename V, unsigned M, typename = std::enable_if<std::is_convertible<V, bool>::value>>
RVecN operator[] (const RVecN< V, M > &conds) const
reference operator[] (size_type idx)
const_reference operator[] (size_type idx) const
void pop_back ()
void pop_back_n (size_type NumItems)
pop_back_val ()
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 reserve (size_type N)
void resize (size_type N)
void resize (size_type N, const T &NV)
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
void swap (RVecImpl &RHS)

Protected Member Functions

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

void * fBeginX
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
using SuperClass = RVecN<T, Internal::VecOps::RVecInlineStorageSize<T>::value>

Private Member Functions

void * getFirstEl () const
 Find the address of the first element.

Private Attributes

char InlineElts [N *sizeof(T)] {}

Friends

void Internal::VecOps::ResetView (RVec< T > &v, T *addr, std::size_t sz)
bool ROOT::Detail::VecOps::IsAdopting (const RVec< T > &v)
bool ROOT::Detail::VecOps::IsSmall (const RVec< T > &v)

#include <ROOT/RVec.hxx>

Inheritance diagram for ROOT::RVec< T >:
ROOT::VecOps::RVecN< T, Internal::VecOps::RVecInlineStorageSize< T >::value > ROOT::Detail::VecOps::RVecImpl< T > ROOT::Internal::VecOps::SmallVectorStorage< T, N > ROOT::Internal::VecOps::SmallVectorTemplateBase< T, bool > ROOT::Internal::VecOps::SmallVectorTemplateCommon< T > ROOT::Internal::VecOps::SmallVectorBase

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::Detail::VecOps::RVecImpl< T >::const_iterator = typename SuperClass::const_iterator
inherited

Definition at line 563 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::VecOps::RVec< T >::const_reference = typename SuperClass::const_reference

Definition at line 1532 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::Detail::VecOps::RVecImpl< T >::iterator = typename SuperClass::iterator
inherited

Definition at line 562 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::VecOps::RVec< T >::reference = typename SuperClass::reference

Definition at line 1531 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::VecOps::RVec< T >::size_type = typename SuperClass::size_type

Definition at line 1533 of file RVec.hxx.

◆ SuperClass

template<typename T>
using ROOT::VecOps::RVec< T >::SuperClass = RVecN<T, Internal::VecOps::RVecInlineStorageSize<T>::value>
private

Definition at line 1526 of file RVec.hxx.

◆ value_type

template<typename T>
using ROOT::VecOps::RVec< T >::value_type = typename SuperClass::value_type

Definition at line 1534 of file RVec.hxx.

Constructor & Destructor Documentation

◆ RVec() [1/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( )
inline

Definition at line 1538 of file RVec.hxx.

◆ RVec() [2/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( size_t Size,
const T & Value )
inlineexplicit

Definition at line 1540 of file RVec.hxx.

◆ RVec() [3/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( size_t Size)
inlineexplicit

Definition at line 1542 of file RVec.hxx.

◆ RVec() [4/12]

template<typename T>
template<typename ItTy, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>::type>
ROOT::VecOps::RVec< T >::RVec ( ItTy S,
ItTy E )
inline

Definition at line 1547 of file RVec.hxx.

◆ RVec() [5/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( std::initializer_list< T > IL)
inline

Definition at line 1551 of file RVec.hxx.

◆ RVec() [6/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( const RVec< T > & RHS)
inline

Definition at line 1553 of file RVec.hxx.

◆ RVec() [7/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( RVec< T > && RHS)
inline

Definition at line 1561 of file RVec.hxx.

◆ RVec() [8/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( Detail::VecOps::RVecImpl< T > && RHS)
inline

Definition at line 1569 of file RVec.hxx.

◆ RVec() [9/12]

template<typename T>
template<unsigned N>
ROOT::VecOps::RVec< T >::RVec ( RVecN< T, N > && RHS)
inline

Definition at line 1572 of file RVec.hxx.

◆ RVec() [10/12]

template<typename T>
template<unsigned N>
ROOT::VecOps::RVec< T >::RVec ( const RVecN< T, N > & RHS)
inline

Definition at line 1575 of file RVec.hxx.

◆ RVec() [11/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( const std::vector< T > & RHS)
inline

Definition at line 1577 of file RVec.hxx.

◆ RVec() [12/12]

template<typename T>
ROOT::VecOps::RVec< T >::RVec ( T * p,
size_t n )
inline

Definition at line 1579 of file RVec.hxx.

Member Function Documentation

◆ append() [1/3]

template<typename T>
template<typename in_iter, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>::value>::type>
void ROOT::Detail::VecOps::RVecImpl< T >::append ( in_iter in_start,
in_iter in_end )
inlineinherited

Add the specified range to the end of the SmallVector.

Definition at line 651 of file RVec.hxx.

◆ append() [2/3]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::append ( size_type NumInputs,
const T & Elt )
inlineinherited

Append NumInputs copies of Elt to the end.

Definition at line 662 of file RVec.hxx.

◆ append() [3/3]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::append ( std::initializer_list< T > IL)
inlineinherited

Definition at line 671 of file RVec.hxx.

◆ assign() [1/3]

template<typename T>
template<typename in_iter, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>::value>::type>
void ROOT::Detail::VecOps::RVecImpl< T >::assign ( in_iter in_start,
in_iter in_end )
inlineinherited

Definition at line 689 of file RVec.hxx.

◆ assign() [2/3]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::assign ( size_type NumElts,
const T & Elt )
inlineinherited

Definition at line 677 of file RVec.hxx.

◆ assign() [3/3]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::assign ( std::initializer_list< T > IL)
inlineinherited

Definition at line 695 of file RVec.hxx.

◆ at() [1/4]

template<typename T>
reference ROOT::VecOps::RVecN< T, N >::at ( size_type pos)
inline

Definition at line 1281 of file RVec.hxx.

◆ at() [2/4]

template<typename T>
const_reference ROOT::VecOps::RVecN< T, N >::at ( size_type pos) const
inline

Definition at line 1291 of file RVec.hxx.

◆ at() [3/4]

template<typename T>
value_type ROOT::VecOps::RVecN< T, N >::at ( size_type pos,
value_type fallback )
inline

No exception thrown. The user specifies the desired value in case the RVecN is shorter than pos.

Definition at line 1302 of file RVec.hxx.

◆ at() [4/4]

template<typename T>
value_type ROOT::VecOps::RVecN< T, N >::at ( size_type pos,
value_type fallback ) const
inline

No exception thrown. The user specifies the desired value in case the RVecN is shorter than pos.

Definition at line 1310 of file RVec.hxx.

◆ 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.

◆ clear()

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::clear ( )
inlineinherited

Definition at line 583 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 )
inlinestaticprotectedinherited

Definition at line 334 of file RVec.hxx.

◆ emplace_back()

template<typename T>
template<typename... ArgTypes>
reference ROOT::Detail::VecOps::RVecImpl< T >::emplace_back ( ArgTypes &&... Args)
inlineinherited

Definition at line 917 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.

◆ erase() [1/2]

template<typename T>
iterator ROOT::Detail::VecOps::RVecImpl< T >::erase ( const_iterator CI)
inlineinherited

Definition at line 701 of file RVec.hxx.

◆ erase() [2/2]

template<typename T>
iterator ROOT::Detail::VecOps::RVecImpl< T >::erase ( const_iterator CS,
const_iterator CE )
inlineinherited

Definition at line 718 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)
protectedinherited

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.

◆ insert() [1/5]

template<typename T>
iterator ROOT::Detail::VecOps::RVecImpl< T >::insert ( iterator I,
const T & Elt )
inlineinherited

Definition at line 770 of file RVec.hxx.

◆ insert() [2/5]

template<typename T>
template<typename ItTy, typename = typename std::enable_if<std::is_convertible< typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>::value>::type>
iterator ROOT::Detail::VecOps::RVecImpl< T >::insert ( iterator I,
ItTy From,
ItTy To )
inlineinherited

Definition at line 856 of file RVec.hxx.

◆ insert() [3/5]

template<typename T>
iterator ROOT::Detail::VecOps::RVecImpl< T >::insert ( iterator I,
size_type NumToInsert,
const T & Elt )
inlineinherited

Definition at line 801 of file RVec.hxx.

◆ insert() [4/5]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::insert ( iterator I,
std::initializer_list< T > IL )
inlineinherited

Definition at line 914 of file RVec.hxx.

◆ insert() [5/5]

template<typename T>
iterator ROOT::Detail::VecOps::RVecImpl< T >::insert ( iterator I,
T && Elt )
inlineinherited

Definition at line 738 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.

◆ operator RVec< U >()

template<typename T>
template<typename U, typename = std::enable_if<std::is_convertible<T, U>::value>>
ROOT::VecOps::RVec< T >::operator RVec< U > ( ) const
inline

Definition at line 1583 of file RVec.hxx.

◆ operator RVecN< U, M >()

ROOT::VecOps::RVecN< T, N >::operator RVecN< U, M > ( ) const
inlineinherited

Definition at line 1276 of file RVec.hxx.

◆ operator=() [1/2]

template<typename T>
RVec & ROOT::VecOps::RVec< T >::operator= ( const RVec< T > & RHS)
inline

Definition at line 1555 of file RVec.hxx.

◆ operator=() [2/2]

template<typename T>
RVec & ROOT::VecOps::RVec< T >::operator= ( RVec< T > && RHS)
inline

Definition at line 1563 of file RVec.hxx.

◆ operator[]() [1/4]

template<typename T>
template<typename V, typename = std::enable_if<std::is_convertible<V, bool>::value>>
RVec ROOT::VecOps::RVec< T >::operator[] ( const RVec< V > & conds) const
inline

Definition at line 1591 of file RVec.hxx.

◆ operator[]() [2/4]

template<typename T>
template<typename V, unsigned M, typename = std::enable_if<std::is_convertible<V, bool>::value>>
RVecN ROOT::VecOps::RVecN< T, N >::operator[] ( const RVecN< V, M > & conds) const
inline

Definition at line 1250 of file RVec.hxx.

◆ operator[]() [3/4]

template<typename T>
reference ROOT::VecOps::RVecN< T, N >::operator[] ( size_type idx)
inline

Definition at line 1239 of file RVec.hxx.

◆ operator[]() [4/4]

template<typename T>
const_reference ROOT::VecOps::RVecN< T, N >::operator[] ( size_type idx) const
inline

Definition at line 1244 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 ( )
inlineinherited

Definition at line 380 of file RVec.hxx.

◆ pop_back_n()

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::pop_back_n ( size_type NumItems)
inlineinherited

Definition at line 628 of file RVec.hxx.

◆ pop_back_val()

template<typename T>
T ROOT::Detail::VecOps::RVecImpl< T >::pop_back_val ( )
inlineinherited

Definition at line 638 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)
inlineinherited

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)
inlineinherited

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.

◆ reserve()

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::reserve ( size_type N)
inlineinherited

Definition at line 622 of file RVec.hxx.

◆ 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.

◆ resize() [1/2]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::resize ( size_type N)
inlineinherited

Definition at line 593 of file RVec.hxx.

◆ resize() [2/2]

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::resize ( size_type N,
const T & NV )
inlineinherited

Definition at line 608 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.

◆ swap()

template<typename T>
void ROOT::Detail::VecOps::RVecImpl< T >::swap ( RVecImpl< T > & RHS)
inherited

Definition at line 932 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 )
inlinestaticprotectedinherited

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 )
inlinestaticprotectedinherited

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

Definition at line 345 of file RVec.hxx.

◆ Internal::VecOps::ResetView

template<typename T>
void Internal::VecOps::ResetView ( RVec< T > & v,
T * addr,
std::size_t sz )
friend

◆ ROOT::Detail::VecOps::IsAdopting

template<typename T>
bool ROOT::Detail::VecOps::IsAdopting ( const RVec< T > & v)
friend

◆ ROOT::Detail::VecOps::IsSmall

template<typename T>
bool ROOT::Detail::VecOps::IsSmall ( const RVec< T > & v)
friend

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.

◆ InlineElts

template<typename T, unsigned N>
char ROOT::Internal::VecOps::SmallVectorStorage< T, N >::InlineElts[N *sizeof(T)] {}
inherited

Definition at line 500 of file RVec.hxx.


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