The mbed platform, like many other C++ projects, required a type that abstract a view to an array.
Several components defined their own array view as it is a common requirement on many projects and when
std::span was proposed to the C++ standard we decided to provide a single implementation of this concept modeled after this interface.
There is a single difference between
size_type is equals to
mbed::Span while it is equals to
std::span. We initially thought of using
size_t to model
size_type but the official proposal was at the time mandating
ptrdiff_t and we opted to follow the standard to avoid compatibility issues in the future. After our initial publication of the code, the standard proposal was amended to use
We will eventually revisit
mbed::Span to conform to the standard and propose an
mstd::span like other mbed std primitives.
As to what to use now, I would stick with
mbed::Span for now because
std::span will be introduced with the C++20 standard that should be released later this year.