Add compile-time checked value constructor to path
This commit is contained in:
parent
51b73aa823
commit
22a8b63d0f
|
@ -21,6 +21,12 @@ export namespace core {
|
||||||
this->buffer[max] = max;
|
this->buffer[max] = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<usize text_size> constexpr path(char const(&text)[text_size]) {
|
||||||
|
static_assert(text_size <= max, "path cannot be longer than maximum length");
|
||||||
|
copy(this->buffer, text.as_bytes());
|
||||||
|
zero(slice{this->buffer}.sliced(text_size, max - text_size));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the base pointer of the path name.
|
* Returns the base pointer of the path name.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue