template class Poco::Array
Overview
STL container like C-style array replacement class. Moreā¦
#include <Array.h> template < class T, std::size_t N > class Array { public: // typedefs typedef T value_type; typedef T* iterator; typedef const T* const_iterator; typedef T& reference; typedef const T& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // enums enum { static_size = N, }; // fields T elems[N]; // methods iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; reverse_iterator rbegin(); const_reverse_iterator rbegin() const; reverse_iterator rend(); const_reverse_iterator rend() const; reference operator[](size_type i); const_reference operator[](size_type i) const; reference at(size_type i); const_reference at(size_type i) const; reference front(); const_reference front() const; reference back(); const_reference back() const; void swap(Array<T, N>& y); const T* data() const; T* data(); T* c_array(); template <typename Other> Array<T, N>& operator=(const Array<Other, N>& rhs); void assign(const T& value); static size_type size(); static bool empty(); static size_type max_size(); };
Detailed Documentation
STL container like C-style array replacement class.
This implementation is based on the idea of Nicolai Josuttis. His original implementation can be found at http://www.josuttis.com/cppcode/array.html.
Fields
T elems[N]
Fixed-size array of elements of type T, public specifier used to make this class a aggregate.
Methods
reference operator[](size_type i)
Element access without range check. If the index is not small than the given size, the behavior is undefined.
const_reference operator[](size_type i) const
Element access without range check. If the index is not small than the given size, the behavior is undefined.
reference at(size_type i)
Element access with range check. Throws Poco::InvalidArgumentException if the index is over range.
const_reference at(size_type i) const
Element access with range check. Throws Poco::InvalidArgumentException if the index is over range.
const T* data() const
Direct access to data (read-only)
T* c_array()
Use array as C array (direct read/write access to data)
template <typename Other> Array<T, N>& operator=(const Array<Other, N>& rhs)
Assignment with type conversion.
void assign(const T& value)
Assign one value to all elements.