NPRPC docs

struct Span_ref

C++

template <class T, class TD> struct Span_ref

A vector of messages or strings inside a buffer. Iterating yields a TD accessor (<Message>_Direct, String_Direct1) for each element.

void Save(nprpc::flat::Span_ref<flat::Post, flat::Post_Direct> posts) override {
  for (auto post : posts)
    store(post.slug(), post.title());
}

include/nprpc/flat.hpp:153

Constructors

Span_ref<T, TD>(flat_buffer &b, const std::tuple<std::uint32_t, std::uint32_t> &range)

A view of the byte range range of b; created by generated code.

include/nprpc/flat.hpp:234

Fields

flat_buffer &buffer

The buffer the elements live in.

include/nprpc/flat.hpp:155

const std::uint32_t first

Byte offset of the first element within buffer.

include/nprpc/flat.hpp:157

const std::uint32_t last

Byte offset one past the last element.

include/nprpc/flat.hpp:159

Methods

Ptr_ref begin()

First element.

include/nprpc/flat.hpp:223

void *data()

Address of the first element.

include/nprpc/flat.hpp:211

void *data_end()

Address one past the last element.

include/nprpc/flat.hpp:217

Ptr_ref end()

One past the last element.

include/nprpc/flat.hpp:225

auto size() const noexcept

Number of elements.

include/nprpc/flat.hpp:231

Operators

Ptr_ref operator[](size_t i)

Element i; dereference it for the accessor.

include/nprpc/flat.hpp:228

Types