Non-owning, trivially copyable view of a contiguous range of T elements, with span semantics.
More...
#include <nanovdb/cuda/Buffer.h>
|
| | BufferView ()=default |
| | Default c-tor of an empty view.
|
| | BufferView (T *data, size_t count) |
| | C-tor viewing a contiguous range; the caller guarantees the underlying storage outlives every use of the view.
|
| T * | data () const |
| | Returns a pointer to the viewed elements, or nullptr if empty.
|
| size_t | size () const |
| | Returns the number of viewed elements.
|
| size_t | size_bytes () const |
| | Returns the size of the viewed range in bytes.
|
| bool | empty () const |
| | Returns true if this view references no elements.
|
| void | destroy () |
| | Detaches the view (nulls the pointer and zeroes the size) without touching the underlying storage – the view is non-owning, so "destroying" it releases nothing. This is the one deliberate deviation from std::span, required by the buffer static interface the handles consume through reset().
|
| void | clear () |
| | Detaches the view.
|
template<typename T>
class nanovdb::cuda::BufferView< T >
Non-owning, trivially copyable view of a contiguous range of T elements, with span semantics.
- Template Parameters
-
| T | element type; spell constness in the element type (e.g. BufferView<const std::byte> is the read-only form), since const on the view itself is shallow. |
◆ BufferView() [1/2]
Default c-tor of an empty view.
◆ BufferView() [2/2]
C-tor viewing a contiguous range; the caller guarantees the underlying storage outlives every use of the view.
- Parameters
-
| data | pointer to the first element |
| count | number of elements |
- Exceptions
-
| std::runtime_error | if data is null while count is non-zero. |
◆ clear()
◆ data()
Returns a pointer to the viewed elements, or nullptr if empty.
◆ destroy()
Detaches the view (nulls the pointer and zeroes the size) without touching the underlying storage – the view is non-owning, so "destroying" it releases nothing. This is the one deliberate deviation from std::span, required by the buffer static interface the handles consume through reset().
◆ empty()
Returns true if this view references no elements.
◆ size()
Returns the number of viewed elements.
◆ size_bytes()
template<typename T>
| size_t size_bytes |
( |
| ) |
const |
|
inline |
Returns the size of the viewed range in bytes.