HomePhabricator

Replace MakeSpan helper with Span deduction guide

Description

Replace MakeSpan helper with Span deduction guide

Summary:
C++17 supports user-defined deduction guides, allowing class constructors to be invoked without specifying class template arguments. Instead, the code can contain rules to infer the template arguments from the constructor argument types.

This alleviates the need for the MakeSpan helper. Convert the existing MakeSpan rules into deduction rules for Span itself, and replace all invocations of MakeSpan with just Span ones.

This is a partial backport of core#23413
https://github.com/bitcoin/bitcoin/pull/23413/commits/568dd2f83900a11a4dbba1250722791a135bf0a9

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14768

Details

Provenance
Pieter Wuille <pieter@wuille.net>Authored on Nov 1 2021, 20:32
PiRKCommitted on Nov 13 2023, 07:05
PiRKPushed on Nov 13 2023, 07:05
Reviewer
Restricted Project
Differential Revision
D14768: Replace MakeSpan helper with Span deduction guide
Parents
rABC6e2cbded9163: [Automated] Update seeds
Branches
Unknown
Tags
Unknown