Skip to content

refactor: Use std::span over Span

Span has some issues:

  • It does not support fixed-size spans, which are available through std::span.
  • It is confusing to have it available and in use at the same time with std::span.
  • It does not obey the standard library iterator build hardening flags. See https://github.com/bitcoin/bitcoin/issues/31272 for a discussion. For example, this allows to catch issues like the one fixed in commit fabeca34.

Both types are type-safe and can even implicitly convert into each other in most contexts.

However, exclusively using std::span seems less confusing, so do it here with a scripted-diff.

Merge request reports

Loading