mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Update absl::Span and std::span differences comment
PiperOrigin-RevId: 856366482 Change-Id: I55a33a56f83ed2c0bf30bd14a08c770f18e13d32
This commit is contained in:
committed by
Copybara-Service
parent
5b086d78c4
commit
eef1a08f4b
@@ -30,18 +30,17 @@
|
||||
// `Span<const T>` when such types may be difficult to identify due to issues
|
||||
// with implicit conversion.
|
||||
//
|
||||
// The C++20 draft standard includes a `std::span` type. As of June 2020, the
|
||||
// The C++20 standard includes a `std::span` type. As of January 2026, the
|
||||
// differences between `absl::Span` and `std::span` are:
|
||||
// * `absl::Span` has `operator==` (which is likely a design bug,
|
||||
// per https://abseil.io/blog/20180531-regular-types)
|
||||
// * `absl::Span` has the factory functions `MakeSpan()` and
|
||||
// `MakeConstSpan()`
|
||||
// * bounds-checked access to `absl::Span` is accomplished with `at()`
|
||||
// however `std::span` now supports the same as of the draft C++26 standard
|
||||
// * `absl::Span` has compiler-provided move and copy constructors and
|
||||
// assignment. This is due to them being specified as `constexpr`, but that
|
||||
// implies const in C++11.
|
||||
// * A read-only `absl::Span<const T>` can be implicitly constructed from an
|
||||
// initializer list.
|
||||
// * `absl::Span` has no `bytes()`, `size_bytes()`, `as_bytes()`, or
|
||||
// `as_writable_bytes()` methods
|
||||
// * `absl::Span` has no static extent template parameter, nor constructors
|
||||
|
||||
Reference in New Issue
Block a user