From 9914c06168ba1db260fab1f71a2abace5c52f481 Mon Sep 17 00:00:00 2001 From: Martok Date: Sun, 18 Jun 2023 21:27:03 +0200 Subject: [PATCH] Issue #2259 - Add mozilla::Vector -> mozilla::Span implicit conversion Based-on: part of m-c 1578339 --- mfbt/Vector.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mfbt/Vector.h b/mfbt/Vector.h index 1fcd77242b..6d5c769e9d 100644 --- a/mfbt/Vector.h +++ b/mfbt/Vector.h @@ -18,6 +18,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" @@ -553,6 +554,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;