From ba968e34b183ae190019e8e947447891ed78ab74 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Fri, 7 Jul 2023 10:04:09 +0800 Subject: [PATCH] import from UXP: Issue #2259 - Add mozilla::Vector -> mozilla::Span implicit conversion (9914c061) --- mfbt/Vector.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mfbt/Vector.h b/mfbt/Vector.h index 3fe093bdd..39a93c86a 100644 --- a/mfbt/Vector.h +++ b/mfbt/Vector.h @@ -19,6 +19,7 @@ #include "mozilla/Move.h" #include "mozilla/OperatorNewExtensions.h" #include "mozilla/ReentrancyGuard.h" +#include "mozilla/Span.h" #include "mozilla/TemplateLib.h" #include "mozilla/TypeTraits.h" @@ -554,6 +555,16 @@ public: return *(end() - 1); } + operator mozilla::Span() const + { + return mozilla::MakeSpan(mBegin, mLength); + } + + operator mozilla::Span() + { + return mozilla::MakeSpan(mBegin, mLength); + } + class Range { friend class Vector;