includes/std: Added new Array and SizedString type

This commit is contained in:
Nik
2022-10-10 22:36:09 +02:00
committed by GitHub
parent 43afbfa120
commit 9c0bf1433c
2 changed files with 25 additions and 0 deletions

9
includes/std/array.pat Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
namespace std {
struct Array<T, auto Size> {
T data[Size] [[inline]];
};
}

View File

@@ -4,6 +4,22 @@
namespace std::string {
struct SizedStringBase<SizeType, DataType> {
SizeType size;
DataType data[size];
} [[sealed, format("std::string::impl::format_sized_string"), transform("std::string::impl::format_sized_string")]];
using SizedString<SizeType> = SizedStringBase<SizeType, char>;
using SizedString16<SizeType> = SizedStringBase<SizeType, char16>;
namespace impl {
fn format_sized_string(ref auto string) {
return string.data;
};
}
fn length(str string) {
return builtin::std::string::length(string);
};