11 #ifndef LARDATAOBJ_UTILITIES_LAZYVECTOR_H 12 #define LARDATAOBJ_UTILITIES_LAZYVECTOR_H 76 template <typename T, typename A = typename std::vector<T>::allocator_type>
464 template <
typename T,
typename A >
468 template <
typename T,
typename A >
473 template <
typename T,
typename A >
478 template <
typename T,
typename A >
484 template <
typename T,
typename A >
499 template <
typename T,
typename A >
513 template <
typename T,
typename A >
531 template <
typename T,
typename A >
548 template <
typename T,
typename A >
566 template <
typename T,
typename A >
586 template <
typename T,
typename A >
594 template <
typename T,
typename A >
599 if (startIndex >= e)
return;
602 storage().reserve(e - startIndex);
608 template <
typename T,
typename A >
613 if (startIndex >= e)
return;
622 template <
typename T,
typename A >
635 template <
typename T,
typename A >
645 template <
typename T,
typename A >
654 template <
typename T,
typename A >
663 template <
typename T,
typename A >
671 template <
typename T,
typename A >
679 template <
typename T,
typename A >
689 #endif // LARDATAOBJ_UTILITIES_LAZYVECTOR_H const_pointer data_address(size_type pos) const
Returns a constant pointer to the specified element.
value_type operator[](size_type pos) const
Returns a copy of the specified element.
Namespace for general, non-LArSoft-specific utilities.
bool has_index(size_type pos) const noexcept
Returns whether the specified position is within the vector.
static value_type const & defaultValueType()
Returns the class default value (used when user does not specify any).
std::vector< TF1, typename std::vector< TF1 >::allocator_type > Data_t
Actual data storage type.
void data_prepare(size_type startIndex, size_type endIndex)
Prepares the vector to store elements in the specified range.
value_type const_get(size_type pos) const
Returns a copy of the specified element.
void data_clear()
Erases all stored data from the container; nominal size is not changed.
typename Data_t::reference reference
void data_init(size_type startIndex, size_type endIndex)
Allocates the specified range and stores default values for it.
void clear()
Removes all stored data and sets the nominal size to 0.
void check_range(size_type pos) const
Throws std::out_of_range if pos is not contained in the vector.
size_type index_of(size_type pos) const
Returns the internal storage index for the specified position.
void reserve(size_type n)
Allocates enough memory in storage to store n elements.
void expand_front(size_type pos)
Expands the storage to include the specified position behind it.
void shrink_to_fit()
Reduces memory usage to the amount needed by the elements with storage.
value_type const & data_defvalue() const
void fix_size()
Makes sure the nominal size is large enough to include all stored data.
static value_type const fDefaultDefaultValue
Default-initialised value of type value_type used as default fallback.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
size_type size() const noexcept
Returns the size of the vector.
bool data_empty() const noexcept
Returns whether no data is actually stored.
bool empty() const noexcept
Returns whether the vector is empty.
typename Data_t::size_type size_type
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Data_t fData
Actual data storage.
size_type data_begin_index() const
Data_t & storage()
Returns the data storage.
typename Data_t::allocator_type allocator_type
void expand_back(size_type pos)
Expands the storage to include the specified position ahead of it.
typename Data_t::const_pointer const_pointer
void data_prepare(size_type n)
Prepares the vector to store n elements from 0.
value_type at(size_type pos) const
Returns a reference to the specified element, throws an exception if not present. ...
Data_t const & storage() const
Returns the data storage.
typename Data_t::difference_type difference_type
size_type fNominalSize
Alleged data size.
void data_init(size_type n)
Allocates and initializes n elements starting from index 0.
value_type const_at(size_type pos) const
Returns a reference to the specified element, throws an exception if not present. ...
void init(size_type pos, size_type n=1U)
Makes the first data allocation.
size_type fFirstIndex
First element currently stored.
size_type data_end_index() const
typename Data_t::value_type value_type
typename Data_t::pointer pointer
void expand(size_type pos)
Expands the storage to include the specified position.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
A contiguous data container expanded on write.
void resize(size_type newSize)
Changes the nominal size of the container.
bool data_has_index(size_type pos) const
Returns the internal storage index for the specified position.
typename Data_t::const_reference const_reference
size_type data_size() const noexcept
Returns the size of data actually stored.
value_type fDefValue
Default value.