Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Utilities/array.hpp
- Revision:
- 7:471901a04573
- Parent:
- 6:a8c83a2e6fa4
--- a/Utilities/array.hpp Wed Jan 23 13:11:04 2019 -0600 +++ b/Utilities/array.hpp Mon Mar 04 08:10:00 2019 -0600 @@ -57,6 +57,7 @@ /// @name Element access /// @{ + reference operator[](size_type pos) { return const_cast<reference>( static_cast<const array &>(*this).operator[](pos)); @@ -81,10 +82,12 @@ } const_pointer data() const { return _buffer; } + /// @} /// @name Iterators - /// @{ + /// @{ + iterator begin() { return const_cast<iterator>(static_cast<const array &>(*this).cbegin()); } @@ -116,10 +119,12 @@ } const_reverse_iterator crend() const { return rend(); } + /// @} /// @name Capacity /// @{ + static bool empty() { return size() == 0; } static size_type size() { return N; } @@ -128,17 +133,20 @@ /// Alternative to size() when a constant expression is required. static const size_type csize = N; + /// @} /// @name Operations /// @{ + void fill(const_reference value) { std::fill(begin(), end(), value); } void swap(array & other) { std::swap_ranges(begin(), end(), other.begin()); } + /// @} /// @private - /// Implementation detail set public to allow aggregate initialization. + /// @note Implementation detail set public to allow aggregate initialization. T _buffer[N]; };