Page MenuHomePhabricator

Replace MakeSpan helper with Span deduction guide
ClosedPublic

Authored by PiRK on Nov 10 2023, 14:42.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC7d917f5c5c97: 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

Event Timeline

PiRK requested review of this revision.Nov 10 2023, 14:42
This revision is now accepted and ready to land.Nov 10 2023, 15:30