vecs
Fast, flexible ecs in C++ with ergonomic API
Loading...
Searching...
No Matches
vecs::Resource< T > Struct Template Reference

A non-owning wrapper around a resource of type T. More...

#include <vecs.h>

Inheritance diagram for vecs::Resource< T >:
vecs::TypeErasedResource

Public Member Functions

 Resource (T *ptr)
 Constructs a non-owning Resource wrapper for a given pointer.
 
T & operator* () const
 
T * operator-> () const
 
T * get () const
 
T * get_mut ()
 
- Public Member Functions inherited from vecs::TypeErasedResource

Detailed Description

template<typename T>
struct vecs::Resource< T >

A non-owning wrapper around a resource of type T.

Resource<T> provides a convenient interface for accessing a resource without taking ownership. The resource pointer must be managed elsewhere, ensuring it remains valid as long as this Resource instance exists.

Template Parameters
TThe type of the underlying resource.

Constructor & Destructor Documentation

◆ Resource()

template<typename T >
vecs::Resource< T >::Resource ( T * ptr)
inlineexplicit

Constructs a non-owning Resource wrapper for a given pointer.

Parameters
ptrPointer to the resource. Must remain valid for the Resource's lifetime.

The documentation for this struct was generated from the following file: