Class 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

typedef Container::value_type value_type#

Typedefs for STL compatibility

typedef Container::allocator_type allocator_type#

Typedefs for STL compatibility

typedef Container::reference reference#

Typedefs for STL compatibility

typedef Container::const_reference const_reference#

Typedefs for STL compatibility

typedef Container::pointer pointer#

Typedefs for STL compatibility

typedef Container::const_pointer const_pointer#

Typedefs for STL compatibility

typedef Container::iterator iterator#

Typedefs for STL compatibility

typedef Container::const_iterator const_iterator#

Typedefs for STL compatibility

typedef Container::reverse_iterator reverse_iterator#

Typedefs for STL compatibility

typedef Container::const_reverse_iterator const_reverse_iterator#

Typedefs for STL compatibility

typedef Container::difference_type difference_type#

Typedefs for STL compatibility

typedef Container::size_type size_type#

Typedefs for STL compatibility

Public Types

typedef internal::ArrayRefContainer<T> Container#
typedef T ValueType#

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#