The document P0122R (2016-02-12) from the Library Evolution Working Group (LEWG)
officially renames the type array_view
to span
:
Changelog
Changes from R0
- Changed the name of the type being proposed from
array_view
to span
following feedback from LEWG at the Kona meeting.
- [...]
We can also read:
Impact on the Standard
This proposal is a pure library extension.
It does not require any changes to standard classes, functions, or headers.
It would be enhanced if could depends on the byte
type
and changes to type aliasing behavior proposed in P0257.
However – if adopted – it may be useful to overload some standard library functions for this new type (an example would be copy()
).
span
has been implemented in standard C++ (C++11) and is being successfully
used within a commercial static analysis tool for C++ code as well as commercial office productivity software.
An open source, reference implementation is available at https://github.com/Microsoft/GSL.
In a next chapter, this documents presents the read-only and read-write (mutable) accesses:
Element types and conversions
span
must be configured with its element type
via the template parameter ValueType
,
which is required to be a complete object type
that is not an abstract class type.
span
supports either read-only or mutable access to the sequence it encapsulates.
To access read-only data, the user can declare a span<const T>
,
and access to mutable data would use a span<T>
.
[...]
See also the Guidelines Support Library Review: span<T>
from Marius Bancila (march 2016) defining span
as:
The Guidelines Support Library is a Microsoft implementation
of some of the types and functions described in the C++ Core Guidelines
maintained by the Standard C++ Foundation.
Among the types provided by the GSL is span<T>
formerly known as array_view<T>
.
span<T>
is a non-owning range of contiguous memory recommended to be used instead of
pointers (and size counter) or standard containers (such as std::vector
or std::array
).
array_view
was renamed tospan
. – Jurdiarray_view
floating around. – Elevator