forked from mirrors/0ad
Remove custom span and use std::span
With C++20 the custom container PS:span, which was a backport of std::span is no longer needed. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -25,9 +25,9 @@
|
||||
|
||||
#include "maths/Vector3D.h"
|
||||
#include "maths/Vector4D.h"
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CQuaternion;
|
||||
|
||||
@@ -334,7 +334,7 @@ public:
|
||||
CVector3D RotateTransposed(const CVector3D& vector) const;
|
||||
|
||||
// Returns 16 element array of floats, e.g. for mat4 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
offsetof(CMatrix3D, _11) == 0 &&
|
||||
offsetof(CMatrix3D, _44) == sizeof(float) * 15u,
|
||||
"CMatrix3D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(_data, 16);
|
||||
return std::span<const float>(_data, 16);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
#ifndef INCLUDED_VECTOR2D
|
||||
#define INCLUDED_VECTOR2D
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CSize2D;
|
||||
|
||||
@@ -165,7 +164,7 @@ public:
|
||||
void operator-=(const CSize2D& size);
|
||||
|
||||
// Returns 2 element array of floats, e.g. for vec2 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler having a different
|
||||
// alignement for an array and a class members.
|
||||
@@ -174,7 +173,7 @@ public:
|
||||
offsetof(CVector2D, X) == 0 &&
|
||||
offsetof(CVector2D, Y) == sizeof(float),
|
||||
"Vector2D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(&X, 2);
|
||||
return std::span<const float>(&X, 2);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
#ifndef INCLUDED_VECTOR3D
|
||||
#define INCLUDED_VECTOR3D
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CFixedVector3D;
|
||||
|
||||
@@ -125,7 +124,7 @@ class CVector3D
|
||||
CVector3D Normalized() const;
|
||||
|
||||
// Returns 3 element array of floats, e.g. for vec3 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
@@ -135,7 +134,7 @@ class CVector3D
|
||||
offsetof(CVector3D, Y) == sizeof(float) &&
|
||||
offsetof(CVector3D, Z) == sizeof(float) * 2u,
|
||||
"Vector3D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(&X, 3);
|
||||
return std::span<const float>(&X, 3);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
#ifndef INCLUDED_VECTOR4D
|
||||
#define INCLUDED_VECTOR4D
|
||||
|
||||
#include "ps/containers/Span.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
class CVector4D
|
||||
{
|
||||
@@ -127,7 +126,7 @@ public:
|
||||
}
|
||||
|
||||
// Returns 4 element array of floats, e.g. for vec4 uniforms.
|
||||
PS::span<const float> AsFloatArray() const
|
||||
std::span<const float> AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
@@ -136,7 +135,7 @@ public:
|
||||
offsetof(CVector4D, X) == 0 &&
|
||||
offsetof(CVector4D, W) == sizeof(float) * 3u,
|
||||
"CVector4D should be properly layouted to use AsFloatArray");
|
||||
return PS::span<const float>(&X, 4);
|
||||
return std::span<const float>(&X, 4);
|
||||
}
|
||||
|
||||
float X, Y, Z, W;
|
||||
|
||||
Reference in New Issue
Block a user