A QuickVec behaves like a std::vector, but does no initialization of its data, making it faster at the cost of having to ensure that uninitialized data is not read. More...
#include <artdaq-core/Core/QuickVec.hh>
Public Types | |
typedef TT_ * | iterator |
Iterator is pointer-to-member type. | |
typedef const TT_ * | const_iterator |
const_iterator is const-pointer-to-member type | |
typedef TT_ & | reference |
reference is reference-to-member tpye | |
typedef const TT_ & | const_reference |
const_reference is const-reference-to-member type | |
typedef TT_ | value_type |
value_type is member type | |
typedef ptrdiff_t | difference_type |
difference_type is ptrdiff_t | |
typedef size_t | size_type |
size_type is size_t | |
Public Member Functions | |
QuickVec (size_t sz) | |
Allocates a QuickVec object, doing no initialization of allocated memory. | |
QuickVec (size_t sz, TT_ val) | |
Allocates a QuickVec object, initializing each element to the given value. | |
virtual | ~QuickVec () noexcept |
Destructor calls free on data. QuickVec compiled in non-unique_ptr mode. | |
QuickVec (std::vector< TT_ > &other) | |
Copies the contents of a std::vector into a new QuickVec object. | |
void | clear () |
Sets the size to 0. QuickVec does not reinitialize memory, so no further action will be taken. | |
QuickVec (const QuickVec &other) | |
Copy Constructor. | |
QUICKVEC & | operator= (const QuickVec &other) |
Copy assignment operator. | |
QuickVec (QuickVec &&other) noexcept | |
Move Constructor. | |
QUICKVEC & | operator= (QuickVec &&other) noexcept |
Move assignemnt operator. | |
TT_ & | operator[] (int idx) |
Returns a reference to a given element. | |
const TT_ & | operator[] (int idx) const |
Returns a const reference to a given element. | |
size_t | size () const |
Accesses the current size of the QuickVec. | |
size_t | capacity () const |
Accesses the current capacity of the QuickVec. | |
iterator | begin () |
Gets an iterator to the beginning of the QuickVec. | |
const_iterator | begin () const |
Gets a const_iterator to the beginning of the QuickVec. | |
iterator | end () |
Gets an iterator to the end of the QuickVec. | |
const_iterator | end () const |
Gets a const_iterator to the end of the QuickVec. | |
void | reserve (size_t size) |
Allocates memory for the QuickVec so that its capacity is at least size. | |
void | resize (size_t size) |
Resizes the QuickVec. | |
void | resize (size_t size, TT_ val) |
Resizes the QuickVec, initializes new elements with val. | |
iterator | insert (const_iterator position, size_t nn, const TT_ &val) |
Inserts an element into the QuickVec. | |
iterator | insert (const_iterator position, const_iterator first, const_iterator last) |
Inserts a range of elements into the QuickVec. | |
iterator | erase (const_iterator first, const_iterator last) |
Erases elements in given range from the QuickVec. | |
void | swap (QuickVec &other) noexcept |
Exchanges references to two QuickVec objects. | |
void | push_back (const value_type &val) |
Adds a value to the QuickVec, resizing if necessary (adds 10% capacity). |
A QuickVec behaves like a std::vector, but does no initialization of its data, making it faster at the cost of having to ensure that uninitialized data is not read.
TT_ | The data type stored in the QuickVec |
Definition at line 87 of file QuickVec.hh.
artdaq::QuickVec::QuickVec | ( | size_t | sz | ) |
artdaq::QuickVec::QuickVec | ( | size_t | sz, | |
TT_ | val | |||
) |
artdaq::QuickVec::QuickVec | ( | std::vector< TT_ > & | other | ) | [inline] |
Copies the contents of a std::vector into a new QuickVec object.
other | The vector to copy |
Definition at line 124 of file QuickVec.hh.
artdaq::QuickVec::QuickVec | ( | const QuickVec & | other | ) | [inline] |
artdaq::QuickVec::QuickVec | ( | QuickVec && | other | ) | [inline] |
Move Constructor.
other | QuickVec to move from |
Definition at line 170 of file QuickVec.hh.
const_iterator artdaq::QuickVec::begin | ( | ) | const |
iterator artdaq::QuickVec::begin | ( | ) |
size_t artdaq::QuickVec::capacity | ( | ) | const |
const_iterator artdaq::QuickVec::end | ( | ) | const |
iterator artdaq::QuickVec::end | ( | ) |
iterator artdaq::QuickVec::erase | ( | const_iterator | first, | |
const_iterator | last | |||
) |
Erases elements in given range from the QuickVec.
first | First element to erase | |
last | Last element to erase |
Erases elements in given range from the QuickVec. Note that since the underlying data structure resembles a std::vector, erase operations are very inefficient! (O(n))
iterator artdaq::QuickVec::insert | ( | const_iterator | position, | |
const_iterator | first, | |||
const_iterator | last | |||
) |
Inserts a range of elements into the QuickVec.
position | Position at which to insert | |
first | const_iterator to first element to insert | |
last | const_iterator to last element to insert |
Inserts elements into the QuickVec. Note that since the underlying data structure resembles a std::vector, insert operations are very inefficient!
iterator artdaq::QuickVec::insert | ( | const_iterator | position, | |
size_t | nn, | |||
const TT_ & | val | |||
) |
Inserts an element into the QuickVec.
position | Position at which to isnert | |
nn | Number of copies of val to insert | |
val | Value to insert |
Inserts an element (or copies thereof) into the QuickVec. Note that since the underlying data structure resembles a std::vector, insert operations are very inefficient!
QUICKVEC& artdaq::QuickVec::operator= | ( | QuickVec && | other | ) | [inline] |
Move assignemnt operator.
other | QuickVec to move from |
Definition at line 187 of file QuickVec.hh.
QUICKVEC& artdaq::QuickVec::operator= | ( | const QuickVec & | other | ) | [inline] |
Copy assignment operator.
other | QuickVec to copy |
Definition at line 157 of file QuickVec.hh.
const TT_& artdaq::QuickVec::operator[] | ( | int | idx | ) | const |
Returns a const reference to a given element.
idx | Element to return |
TT_& artdaq::QuickVec::operator[] | ( | int | idx | ) |
Returns a reference to a given element.
idx | Element to return |
void artdaq::QuickVec::push_back | ( | const value_type & | val | ) |
void artdaq::QuickVec::reserve | ( | size_t | size | ) |
void artdaq::QuickVec::resize | ( | size_t | size, | |
TT_ | val | |||
) |
void artdaq::QuickVec::resize | ( | size_t | size | ) |
size_t artdaq::QuickVec::size | ( | ) | const |
void artdaq::QuickVec::swap | ( | QuickVec & | other | ) |