20 template<
typename OffsetT = UInt64,
typename LengthT = OffsetT>
struct TRange final {
30 constexpr
TRange() noexcept = default;
33 constexpr
TRange(OffsetT offset, LengthT length) noexcept : offset(offset), length(length) {}
39 [[nodiscard]]
constexpr bool operator[](OffsetT off)
const noexcept;
42 [[nodiscard]]
constexpr explicit operator bool() const noexcept;
45 [[nodiscard]] constexpr
bool empty() const noexcept;
48 constexpr
void clear() noexcept;
50 [[nodiscard]] constexpr OffsetT begin() const noexcept {
return offset; }
51 [[nodiscard]]
constexpr OffsetT
end() const noexcept {
return offset + length; }
55 return off >= offset &&
off < (offset + length);
71 template<
typename OffsetT,
typename LengthT>
73 OffsetT start = std::max<OffsetT>(a.offset, b.offset);
74 OffsetT end = std::min<OffsetT>(a.offset + a.length, b.offset + b.length);
90 return a.offset == b.offset && a.length == b.length;
100 return a.offset != b.offset || a.length != b.length;
109 template<
typename OffsetT,
typename LengthT>
111 return offset <
range.offset;
120 template<
typename OffsetT,
typename LengthT>
131 template<
typename OffsetT,
typename LengthT>
133 return offset >= (
range.offset +
range.length);
142 template<
typename OffsetT,
typename LengthT>
165 using Type = CeresEngine::Math::TRange<Offset, Length>;
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
Definition Application.hpp:19
std::uint64_t UInt64
Definition DataTypes.hpp:26
auto range()
Returns an iterator that increases it's value from 0 to end by 1 for each step.
Definition Iterator.hpp:350
constexpr bool operator<(const Optional< A > &lhs, const Optional< B > &rhs)
Definition Optional.hpp:162
bool operator!=(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:416
std::int32_t Int32
Definition DataTypes.hpp:21
std::uint16_t UInt16
Definition DataTypes.hpp:20
constexpr bool operator>=(const Optional< A > &lhs, const Optional< B > &rhs)
Definition Optional.hpp:157
std::uint8_t UInt8
Definition DataTypes.hpp:17
bool operator==(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:411
std::int64_t Int64
Definition DataTypes.hpp:24
constexpr bool operator>(const Optional< A > &lhs, const Optional< B > &rhs)
Definition Optional.hpp:152
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr Byte operator&(const Byte left, const Byte right) noexcept
Definition DataTypes.hpp:63
std::int8_t Int8
Definition DataTypes.hpp:15
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
std::int16_t Int16
Definition DataTypes.hpp:18
constexpr bool operator<=(const Optional< A > &lhs, const Optional< B > &rhs)
Definition Optional.hpp:167
constexpr TRange & operator=(const TRange &) noexcept=default
constexpr OffsetT end() const noexcept
Definition Range.hpp:51
constexpr TRange(const TRange &) noexcept=default