|
OpenTTD Source 20261112-master-gbcbec5e63f
|
Helper to map some SDL functions to behave like a std::range. More...
Public Member Functions | |
| template<typename Func, typename ... Args> | |
| SDLRange (Func func, Args... args) | |
| Create the range. | |
| ~SDLRange () | |
| Free the data. | |
| SDLRange (SDLRange &)=delete | |
| Do not copy. | |
| SDLRange & | operator= (const SDLRange &)=delete |
| Do not assign. | |
| constexpr T * | begin () const |
| Iterator to the begin of the data. | |
| constexpr T * | end () const |
| Iterator to the end of the data. | |
| constexpr size_t | size () const |
| The number of elements in this range. | |
Private Attributes | |
| T * | data = nullptr |
| The base pointer of the array. | |
| int | count = 0 |
| The number of elements. | |
Helper to map some SDL functions to behave like a std::range.
The kinds of functions this can be used on are those for which the last parameter is a reference to a count, that return a pointer to an array of elements that needs to be freed using SDL_free once not needed anymore.
Definition at line 52 of file sdl3_v.cpp.
|
inline |
Create the range.
| func | The function that returns the pointer. |
| args | Extra arguments to pass to the function. |
Definition at line 62 of file sdl3_v.cpp.
Referenced by operator=(), and SDLRange().
Free the data.
Definition at line 64 of file sdl3_v.cpp.
Iterator to the begin of the data.
Definition at line 73 of file sdl3_v.cpp.
References T.
The number of elements in this range.
Definition at line 85 of file sdl3_v.cpp.
Referenced by FindStartupDisplay().
The base pointer of the array.
Definition at line 53 of file sdl3_v.cpp.