#include <nda/mem/handle.hpp>
template<typename T,
AddressSpace AdrSp = Host>
struct nda::mem::handle_borrowed< T, AdrSp >
A non-owning handle for a memory block on the heap.
- Template Parameters
-
Definition at line 858 of file handle.hpp.
|
|
using | value_type = T |
| | Value type of the data.
|
|
|
| handle_borrowed ()=default |
| | Default constructor leaves the handle in a null state (nullptr).
|
template<Handle H>
requires (address_space == H::address_space and (std::is_const_v<value_type> or !std::is_const_v<typename H::value_type>) and std::is_same_v<const value_type, const typename H::value_type>) |
| | handle_borrowed (H const &h, long offset=0) noexcept |
| | Construct a borrowed handle from a another handle.
|
|
| handle_borrowed (handle_borrowed const &)=default |
| | Default copy constructor.
|
| | handle_borrowed (T *ptr) noexcept |
| | Construct a borrowed handle from a pointer to the data.
|
| T * | data () const noexcept |
| | Get a pointer to the stored data.
|
| bool | is_null () const noexcept |
| | Check if the handle is in a null state.
|
|
handle_borrowed & | operator= (handle_borrowed &&)=default |
| | Default move assignment operator.
|
|
handle_borrowed & | operator= (handle_borrowed const &)=default |
| | Default copy assignment operator.
|
| T const & | operator[] (long i) const noexcept |
| | Subscript operator to access the data.
|
| T & | operator[] (long i) noexcept |
| | Subscript operator to access the data.
|
| handle_heap< T0 > const * | parent () const |
| | Get a pointer to the parent handle.
|
◆ handle_borrowed() [1/2]
Construct a borrowed handle from a pointer to the data.
- Parameters
-
| ptr | Pointer to the start of the data. |
Definition at line 892 of file handle.hpp.
◆ handle_borrowed() [2/2]
template<Handle H>
requires (
address_space == H::address_space and (std::is_const_v<
value_type> or !std::is_const_v<typename H::value_type>) and std::is_same_v<const
value_type, const typename H::value_type>)
Construct a borrowed handle from a another handle.
- Template Parameters
-
- Parameters
-
| h | Other handle. |
| offset | Pointer offset from the start of the data (in number of elements). |
Definition at line 904 of file handle.hpp.
◆ data()
Get a pointer to the stored data.
- Returns
- Pointer to the start of the handled memory.
Definition at line 940 of file handle.hpp.
◆ is_null()
Check if the handle is in a null state.
- Returns
- True if the data is a nullptr.
Definition at line 928 of file handle.hpp.
◆ operator[]() [1/2]
Subscript operator to access the data.
- Parameters
-
| i | Index of the element to access. |
- Returns
- Const reference to the element at the given index.
Definition at line 922 of file handle.hpp.
◆ operator[]() [2/2]
Subscript operator to access the data.
- Parameters
-
| i | Index of the element to access. |
- Returns
- Reference to the element at the given index.
Definition at line 914 of file handle.hpp.
◆ parent()
Get a pointer to the parent handle.
- Returns
- Pointer to the parent handle.
Definition at line 934 of file handle.hpp.
The documentation for this struct was generated from the following file: