mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-30 22:07:58 +03:00
Replace Misc::Span by std::span
This commit is contained in:
parent
bf0865d03d
commit
e4a254deb7
6 changed files with 7 additions and 43 deletions
|
@ -1,36 +0,0 @@
|
|||
#ifndef OPENMW_COMPONENTS_MISC_SPAN_H
|
||||
#define OPENMW_COMPONENTS_MISC_SPAN_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Misc
|
||||
{
|
||||
template <class T>
|
||||
class Span
|
||||
{
|
||||
public:
|
||||
constexpr Span() = default;
|
||||
|
||||
constexpr Span(T* pointer, std::size_t size)
|
||||
: mPointer(pointer)
|
||||
, mSize(size)
|
||||
{}
|
||||
|
||||
template <class Range>
|
||||
constexpr Span(Range& range)
|
||||
: Span(range.data(), range.size())
|
||||
{}
|
||||
|
||||
constexpr T* begin() const { return mPointer; }
|
||||
|
||||
constexpr T* end() const { return mPointer + mSize; }
|
||||
|
||||
constexpr std::size_t size() const { return mSize; }
|
||||
|
||||
private:
|
||||
T* mPointer = nullptr;
|
||||
std::size_t mSize = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue