Medial Code Documentation
|
A vector-like type that holds a reference counted resource. More...
#include <ref_resource_view.h>
Public Types | |
using | value_type = T |
using | size_type = std::uint64_t |
Public Member Functions | |
RefResourceView (value_type *ptr, size_type n, std::shared_ptr< common::ResourceHandler > mem) | |
RefResourceView (value_type *ptr, size_type n, std::shared_ptr< common::ResourceHandler > mem, T const &init) | |
Construct a view on ptr with length n. | |
RefResourceView (RefResourceView const &that)=delete | |
RefResourceView & | operator= (RefResourceView const &that)=delete |
RefResourceView (RefResourceView &&that)=default | |
We allow move assignment for lazy initialization. | |
RefResourceView & | operator= (RefResourceView &&that)=default |
size_type | size () const |
size_type | size_bytes () const |
value_type * | data () |
value_type const * | data () const |
bool | empty () const |
auto | cbegin () const |
auto | begin () |
auto | begin () const |
auto | cend () const |
auto | end () |
auto | end () const |
auto const & | front () const |
auto & | front () |
auto const & | back () const |
auto & | back () |
value_type & | operator[] (size_type i) |
value_type const & | operator[] (size_type i) const |
auto | Resource () const |
Get the underlying resource. | |
Protected Member Functions | |
void | Init (value_type *ptr, size_type size, std::shared_ptr< common::ResourceHandler > mem) |
A vector-like type that holds a reference counted resource.
The vector size is immutable after construction. This way we can swap the underlying resource when needed.
|
inline |
Construct a view on ptr with length n.
The ptr is held by the mem resource.
ptr | The pointer to view. |
n | The length of the view. |
mem | The owner of the pointer. |
init | Initialize the view with this value. |