File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 37
37
38
38
#include < libvisual/lv_intrusive_ptr.hpp>
39
39
#include < memory>
40
+ #include < span>
40
41
#include < cstdlib>
41
42
42
43
namespace LV {
@@ -88,6 +89,24 @@ namespace LV {
88
89
*/
89
90
void destroy_content ();
90
91
92
+ /* *
93
+ * Returns an std::span that is a view of the entire buffer.
94
+ */
95
+ template <typename T>
96
+ std::span<T> as_span () noexcept
97
+ {
98
+ return {static_cast <T*> (get_data ()), get_size () / sizeof (T)};
99
+ }
100
+
101
+ /* *
102
+ * Returns an std::span that is a view of the entire buffer.
103
+ */
104
+ template <typename T>
105
+ std::span<T const > as_span () const noexcept
106
+ {
107
+ return {static_cast <T const *> (get_data ()), get_size () / sizeof (T)};
108
+ }
109
+
91
110
/* *
92
111
* Sets the data pair (data and its size).
93
112
*
You can’t perform that action at this time.
0 commit comments