template <typename E>

class VectorView

Defined at line 43 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

Vector (conditional on element)

Public Methods

void VectorView<E> ()

Defined at line 52 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (AnyArena & allocator, size_t size)

Allocates a vector using an arena. |T| is default constructed.

Defined at line 55 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (AnyArena & allocator, size_t initial_size, size_t capacity)

Defined at line 57 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (std::nullptr_t data, size_t size)

Defined at line 61 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

template <typename InputIterator>
void VectorView<E> (AnyArena & arena, InputIterator first, InputIterator last)

Allocates a vector using an arena and copies the data from the supplied iterators.

The iterator must satisfy the random_access_iterator concept.

Example:

fidl::Arena arena;

std::vector

<int32

_t> vec(...);

// Copy contents of |vec| into |arena|, and return a view of the copies content.

fidl::VectorView

<int32

_t> vv(arena, vec.begin(), vec.end());

Defined at line 74 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (AnyArena & arena, cpp20::span<const T> span)

Allocates a vector using an arena and copies the data from the supplied |span|.

Defined at line 86 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (AnyArena & arena, cpp20::span<const T> span)

Allocates a vector using an arena and copies the data from the supplied |span|.

Defined at line 86 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (AnyArena & arena, const std::vector<std::remove_cv_t<T>> & vector)

Allocates a vector using an arena and copies the data from the supplied |std::vector|.

Defined at line 90 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (const VectorView<T> & )

Defined at line 93 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

VectorView<T> & operator= (const VectorView<T> & )

Defined at line 94 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

template <typename _ = std::enable_if<!std::is_same_v<T, std::remove_cv_t<T>>>>
void VectorView<E> (const VectorView<std::remove_cv_t<T>> & other)

NOLINTNEXTLINE(google-explicit-constructor) Intentionally implicit

Defined at line 98 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

template <typename _ = std::enable_if<!std::is_same_v<T, std::remove_cv_t<T>>>>
VectorView<T> & operator= (const VectorView<std::remove_cv_t<T>> & other)

NOLINTNEXTLINE(google-explicit-constructor) Intentionally implicit

Defined at line 103 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

VectorView<T> FromExternal (std::vector<std::remove_cv_t<T>> & from)

Constructs a fidl::VectorView by unsafely borrowing other sequences.

|FromExternal| methods are the only way to reference data which is not

managed by an arena. Their usage is discouraged. The lifetime of the

referenced vector must be longer than the lifetime of the created

|VectorView|.

For example:

std::vector

<int32

_t> my_vector = { 1, 2, 3 };

auto my_view =

fidl::VectorView

<int32

_t>::FromExternal(my_vector);

Defined at line 122 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

template <size_t size>
VectorView<T> FromExternal (std::array<T, size> & from)

Defined at line 126 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

template <size_t size>
VectorView<T> FromExternal (T (&)[size] data)

Defined at line 130 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

VectorView<T> FromExternal (T * data, size_t size)

Defined at line 133 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

cpp20::span<T> get ()

Defined at line 137 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

size_t size ()

Defined at line 139 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void set_size (size_t size)

TODO(https://fxbug.dev/430121763): Migrate away from this setter.

Defined at line 142 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

size_t count ()

Deprecated in favor of `size()`.

The Banjo convention was to use `count()` to express quantities of

elements, and use `size()` to express quantities of bytes. This method

facilitates migrating from Banjo to FIDL.

Defined at line 149 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void set_count (size_t size)

Deprecated in favor of `set_size()`. See `count()` for historical context.

Defined at line 153 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

T * data ()

Defined at line 156 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

bool empty ()

Returns if the vector view is empty.

Defined at line 159 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

bool is_null ()

TODO(https://fxbug.dev/42061094): |is_null| is used to check if an optional view type

is absent. This can be removed if optional view types switch to

|fidl::WireOptional|.

Defined at line 164 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

T & at (size_t offset)

Defined at line 166 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

T & operator[] (size_t offset)

Defined at line 167 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

T * begin ()

Defined at line 169 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

const T * cbegin ()

Defined at line 170 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

T * end ()

Defined at line 172 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

const T * cend ()

Defined at line 173 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void Allocate (AnyArena & arena, size_t size)

Allocates |size| items of |T| from the |arena|, forgetting any values

currently held by the vector view. |T| is default constructed.

Defined at line 177 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

Protected Methods

void VectorView<E> (std::vector<std::remove_cv_t<T>> & from)

Defined at line 183 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

void VectorView<E> (T * data, size_t size)

Defined at line 185 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/vector_view.h

Records

Friends

template <typename E>
class LayoutChecker
template <typename>
class VectorView