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:158

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:239

Fields

flat_buffer &buffer

The buffer the elements live in.

include/nprpc/flat.hpp:160

const std::uint32_t first

Byte offset of the first element within buffer.

include/nprpc/flat.hpp:162

const std::uint32_t last

Byte offset one past the last element.

include/nprpc/flat.hpp:164

Methods

Ptr_ref begin()

First element.

include/nprpc/flat.hpp:228

void *data()

Address of the first element.

include/nprpc/flat.hpp:216

void *data_end()

Address one past the last element.

include/nprpc/flat.hpp:222

Ptr_ref end()

One past the last element.

include/nprpc/flat.hpp:230

auto size() const noexcept

Number of elements.

include/nprpc/flat.hpp:236

Operators

Ptr_ref operator[](size_t i)

Element i; dereference it for the accessor.

include/nprpc/flat.hpp:233

Types