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:714
Constructors
OwnedSpan<T>() = default
An empty span; valid() is false.
include/nprpc/flat.hpp:722
OwnedSpan<T>(std::shared_ptr< ::nprpc::flat_buffer> buf, Span<T> span) noexcept
Views span inside buf, keeping buf alive.
include/nprpc/flat.hpp:725
Methods
T *begin() const noexcept
First element.
include/nprpc/flat.hpp:737
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:750
T *data() const noexcept
First element.
include/nprpc/flat.hpp:733
T *end() const noexcept
One past the last element.
include/nprpc/flat.hpp:739
uint32_t size() const noexcept
Number of elements.
include/nprpc/flat.hpp:735
bool valid() const noexcept
Whether the span refers to a buffer.
include/nprpc/flat.hpp:747
Operators
operator Span<const T>() const noexcept
A non-owning read-only view of the same elements.
include/nprpc/flat.hpp:755
operator Span<T>() noexcept
A non-owning view of the same elements.
include/nprpc/flat.hpp:753
T &operator[](size_t i)
Element i.
include/nprpc/flat.hpp:742
const T &operator[](size_t i) const
Element i.
include/nprpc/flat.hpp:744