Shared span with ownership tracking.
More...
#include <lagrange/utils/SharedSpan.h>
|
using | element_type = T |
|
using | value_type = std::remove_cv_t< T > |
|
|
| SharedSpan () |
| Default constructor for empty buffer.
|
|
| SharedSpan (std::shared_ptr< T > data, size_t size) |
| Constructing a SharedSpan object from a shared buffer. More...
|
|
span< T > | ref () |
|
span< const T > | get () const |
|
std::shared_ptr< const T > | owner () const |
|
size_t | size () const |
|
|
std::shared_ptr< T > | m_data |
|
size_t | m_size = 0 |
|
template<typename T>
class lagrange::SharedSpan< T >
Shared span with ownership tracking.
Sometimes the buffer referred by a span is already using certain kind of memory ownership sharing schemes (e.g. shared_ptr
or PyObject). The SharedSpan class can be used to keep the buffer alive by taking a shared of the ownership of the buffer.
- Template Parameters
-
- See also
- make_shared_span
◆ SharedSpan()
SharedSpan |
( |
std::shared_ptr< T > |
data, |
|
|
size_t |
size |
|
) |
| |
|
inline |
Constructing a SharedSpan object from a shared buffer.
- Parameters
-
data | The owner of the shared buffer. |
size | The size of the shared buffer. |
◆ ref()
- Returns
- A writable span of the shared buffer.
◆ get()
span< const T > get |
( |
| ) |
const |
|
inline |
- Returns
- A readonly span of the shared buffer.
◆ owner()
std::shared_ptr< const T > owner |
( |
| ) |
const |
|
inline |
- Returns
- The memory owner of the shared buffer.
◆ size()
The documentation for this class was generated from the following file: