Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#
Diff: Utilities/span.hpp
- Revision:
- 6:471901a04573
- Parent:
- 5:a8c83a2e6fa4
diff -r a8c83a2e6fa4 -r 471901a04573 Utilities/span.hpp
--- a/Utilities/span.hpp Wed Jan 23 13:11:04 2019 -0600
+++ b/Utilities/span.hpp Mon Mar 04 08:10:00 2019 -0600
@@ -77,6 +77,7 @@
public:
/// @name Iterators
/// @{
+
iterator begin() const {
return const_cast<iterator>(static_cast<const span_base &>(*this).cbegin());
}
@@ -100,19 +101,23 @@
const_reverse_iterator crend() const {
return const_reverse_iterator(cbegin());
}
+
/// @}
/// @name Element access
/// @{
+
reference operator[](index_type idx) const { return data()[idx]; }
reference operator()(index_type idx) const { return operator[](idx); }
pointer data() const { return data_; }
+
/// @}
/// @name Subviews
/// @{
+
template <index_type Count> span<element_type, Count> first() const {
return subspan<0, Count>();
}
@@ -133,6 +138,7 @@
return span<element_type>(
data() + Offset, Count == dynamic_extent ? size() - Offset : Count);
}
+
/// @}
private:
@@ -185,18 +191,22 @@
/// @name Observers
/// @{
+
static index_type size() { return extent; }
static index_type size_bytes() { return size() * sizeof(element_type); }
static bool empty() { return size() == 0; }
+
/// @}
/// @name Subviews
/// @{
+
template <index_type Count> span<element_type, Count> last() const {
return this->template subspan<extent - Count, Count>();
}
+
/// @}
};
@@ -246,18 +256,22 @@
/// @name Observers
/// @{
+
index_type size() const { return size_; }
index_type size_bytes() const { return size() * sizeof(element_type); }
bool empty() const { return size() == 0; }
+
/// @}
/// @name Subviews
/// @{
+
template <index_type Count> span<element_type, Count> last() const {
return span<element_type, Count>(this->data() + (size() - Count), Count);
}
+
/// @}
private: