class OwnedSpan
C++
template <typename T> class OwnedSpan
Owns a flat_buffer (via shared_ptr) and exposes a zero-copy span view. Used as the parameter type for 'out direct vector<T>' (primitive element) RPC arguments so the receive buffer is never copied.
include/nprpc/flat.hpp:652
Constructors
OwnedSpan<T>() = default
An empty span; valid() is false.
include/nprpc/flat.hpp:660
OwnedSpan<T>(std::shared_ptr< ::nprpc::flat_buffer> buf, Span<T> span) noexcept
Views span inside buf, keeping buf alive.
include/nprpc/flat.hpp:663
Methods
T *begin() const noexcept
First element.
include/nprpc/flat.hpp:675
std::shared_ptr< ::nprpc::flat_buffer> buffer() const noexcept
Keeps the underlying buffer alive (e.g. for async use after the RPC call).
include/nprpc/flat.hpp:688
T *data() const noexcept
First element.
include/nprpc/flat.hpp:671
T *end() const noexcept
One past the last element.
include/nprpc/flat.hpp:677
uint32_t size() const noexcept
Number of elements.
include/nprpc/flat.hpp:673
bool valid() const noexcept
Whether the span refers to a buffer.
include/nprpc/flat.hpp:685
Operators
operator Span<const T>() const noexcept
A non-owning read-only view of the same elements.
include/nprpc/flat.hpp:693
operator Span<T>() noexcept
A non-owning view of the same elements.
include/nprpc/flat.hpp:691
T &operator[](size_t i)
Element i.
include/nprpc/flat.hpp:680
const T &operator[](size_t i) const
Element i.
include/nprpc/flat.hpp:682