Luna/libluna/include/luna/Slice.h
apio 00832163d4
All checks were successful
continuous-integration/drone/push Build is passing
libos: Add Process::exec
2023-04-18 18:39:37 +02:00

53 lines
713 B
C++

#pragma once
#include <luna/Types.h>
template <typename T> class Slice
{
typedef T* Iterator;
typedef const T* ConstIterator;
public:
Slice(T* data, usize size) : m_data(data), m_size(size)
{
}
const T* data() const
{
return m_data;
}
T* data()
{
return m_data;
}
usize size() const
{
return m_size;
}
Iterator begin()
{
return m_data;
}
ConstIterator begin() const
{
return m_data;
}
Iterator end()
{
return m_data + m_size;
}
ConstIterator end() const
{
return m_data + m_size;
}
private:
T* const m_data;
const usize m_size;
};