From c87116b33267a8df388ca3652d211b7f8254a98d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 18 Oct 2023 14:35:59 +0200 Subject: Issue #2281 - Add some deduction guides for class template arguments. This is necessary if we want to start using Span() constructors instead of the MakeSpan() kludge. --- mfbt/Span.h | 9 +++++++++ xpcom/glue/nsTArray.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/mfbt/Span.h b/mfbt/Span.h index e71e068c60..fe679aa8bf 100644 --- a/mfbt/Span.h +++ b/mfbt/Span.h @@ -810,6 +810,15 @@ private: storage_type> storage_; }; +template +Span(T (&aArr)[Extent]) -> Span; + +template +Span(Container&) -> Span; + +template +Span(const Container&) -> Span; + // [Span.comparison], Span comparison operators template inline bool diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 03913a3765..47635de318 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -2466,6 +2466,12 @@ MakeSpan(const nsTArray_Impl& aTArray) return aTArray; } +template +Span(nsTArray_Impl&) -> Span; + +template +Span(const nsTArray_Impl&) -> Span; + } // namespace mozilla // Assert that AutoTArray doesn't have any extra padding inside. -- cgit v1.2.3