Commit a1b95211 authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

mojo: Add the size template parameter to ArrayTraits<base::span>

The ArrayTraits specialization for base::span with a specified size was
considered to be missing. This caused accessors in mojom traits that
returned a base::span with a specified size to fail to compile with:

error: static_assert failed due to requirement 'internal::AlwaysFalse<span<const unsigned char, 6> >::value' "Cannot find the mojo::ArrayTraits specialization. Did you forget to include the corresponding header file?"
Change-Id: I61ab07f2a1f74ea2eb5073b2776c995ce86b6255
Reviewed-on: https://chromium-review.googlesource.com/c/1356159
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612529}
parent ecb81c3f
......@@ -12,8 +12,8 @@
namespace mojo {
template <typename T>
struct ArrayTraits<base::span<T>> {
template <typename T, size_t Extent>
struct ArrayTraits<base::span<T, Extent>> {
using Element = T;
// There is no concept of a null span, as it is indistinguishable from the
......
......@@ -17,7 +17,8 @@ template <>
class StructTraits<device::mojom::BluetoothAddressDataView,
std::array<uint8_t, 6>> {
public:
static base::span<const uint8_t> address(const std::array<uint8_t, 6>& addr) {
static base::span<const uint8_t, 6> address(
const std::array<uint8_t, 6>& addr) {
return base::make_span(addr);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment