Add a Span constructor to SizePrefixedFlatbufferVector

This lets us copy without duplicating the copy code all over the place.

Change-Id: I17e8746ad1186c833a82167fee06efa4c0ffad42
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/flatbuffers.h b/aos/flatbuffers.h
index 5bef204..90742c3 100644
--- a/aos/flatbuffers.h
+++ b/aos/flatbuffers.h
@@ -413,9 +413,13 @@
       : data_(std::move(data)) {}
 
   // Builds a Flatbuffer by copying the data from the other flatbuffer.
-  SizePrefixedFlatbufferVector(const SizePrefixedFlatbuffer<T> &other) {
-    data_.resize(other.span().size());
-    memcpy(data_.data(), other.span().data(), data_.size());
+  SizePrefixedFlatbufferVector(const SizePrefixedFlatbuffer<T> &other)
+      : SizePrefixedFlatbufferVector(other.span()) {}
+
+  // Builds a flatbuffer by copying the data from the provided span.
+  SizePrefixedFlatbufferVector(const absl::Span<const uint8_t> span) {
+    data_.resize(span.size());
+    memcpy(data_.data(), span.data(), data_.size());
   }
 
   // Copy constructor.