Avogadro::Core::Array#

template<typename T>
class Array#

Base class for array containers.

This templated class gives us a container with copy-on-write semantics, allowing for functions to effectively share data without exposing access or copying large amounts of data until the container is changed.

All const functions can be called without copying any data, but a call to a non-const function will trigger a detach call. This is a no-op when the reference count is 1, and will perform a deep copy when the reference count is greater than 1.

Unnamed Group

using value_type = typename Container::value_type#

Typedefs for STL compatibility

using allocator_type = typename Container::allocator_type#

Typedefs for STL compatibility

using reference = typename Container::reference#

Typedefs for STL compatibility

using const_reference = typename Container::const_reference#

Typedefs for STL compatibility

using pointer = typename Container::pointer#

Typedefs for STL compatibility

using const_pointer = typename Container::const_pointer#

Typedefs for STL compatibility

using iterator = typename Container::iterator#

Typedefs for STL compatibility

using const_iterator = typename Container::const_iterator#

Typedefs for STL compatibility

using reverse_iterator = typename Container::reverse_iterator#

Typedefs for STL compatibility

using const_reverse_iterator = typename Container::const_reverse_iterator#

Typedefs for STL compatibility

using difference_type = typename Container::difference_type#

Typedefs for STL compatibility

using size_type = typename Container::size_type#

Typedefs for STL compatibility

Public Types

using Container = internal::ArrayRefContainer<T>#
using ValueType = T#

Public Functions

inline Array()#

Constructors for new containers.

inline explicit Array(const size_t n, const ValueType &value = ValueType())#
template<typename InputIterator>
inline Array(InputIterator first, InputIterator last)#
inline Array(const Array &other)#

Copy constructor, note the copy made of the internal data of other.

inline ~Array()#
inline void detachWithCopy()#

Explicitly detach from any other implicitly shared containers. This is not normally necessary, but can be useful when you want to ensure you have a copy of all data.

inline void detach()#

Explicitly detach from any other implicitly shared containers. This version does not copy the data.

inline T *data()#

Retrieve a pointer to the underlying data.

inline const T *data() const#
inline const T *constData() const#
inline size_t size() const#
inline size_t max_size() const#
inline bool empty() const#
inline size_t capacity() const#
inline void reserve(const size_t &sz)#
inline void resize(const size_t &sz, const ValueType &t = ValueType())#
inline void clear()#
inline const_iterator begin() const#
inline const_iterator end() const#
inline iterator begin()#
inline iterator end()#
inline const_reverse_iterator rbegin() const#
inline const_reverse_iterator rend() const#
inline reverse_iterator rbegin()#
inline reverse_iterator rend()#
inline reference front()#
inline const_reference front() const#
inline reference back()#
inline const_reference back() const#
template<class InputIterator>
inline void assign(InputIterator first, InputIterator last)#
inline void assign(size_type n, const value_type &val)#
inline void push_back(const ValueType &v)#
inline void pop_back()#
inline iterator insert(iterator position, const value_type &val)#
inline void insert(iterator position, size_type n, const value_type &val)#
template<class InputIterator>
inline void insert(iterator position, InputIterator first, InputIterator last)#
inline iterator erase(iterator position)#
inline iterator erase(iterator first, iterator last)#
inline const ValueType &operator[](const std::size_t &idx) const#
inline ValueType &operator[](const std::size_t &idx)#
inline ValueType at(const std::size_t &idx) const#
template<typename OtherT>
inline Array &operator=(const std::vector<OtherT> &v)#
template<typename OtherT>
inline Array &operator=(const Array<OtherT> &v)#
inline Array &operator=(const Array &v)#
inline void swap(Array<ValueType> &other)#
inline void swapAndPop(Index index)#
Parameters:

index – array position to delete if the index is valid swap it with the last position and pop back. This function does not preserve the elements order.

Protected Attributes

Container *d#