Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,19 @@ inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
std::string_view str);

// Used to be a macro, hence the uppercase name.
template <int N>
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(
v8::Isolate* isolate,
const char(&data)[N]) {
template <std::size_t N>
requires(N > 0)
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(v8::Isolate* isolate,
const char (&data)[N]) {
CHECK_EQ(data[N - 1], '\0');
return OneByteString(isolate, data, N - 1);
}

template <std::size_t N>
requires(N > 0)
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(
v8::Isolate* isolate,
const std::array<char, N>& arr) {
v8::Isolate* isolate, const std::array<char, N>& arr) {
CHECK_EQ(arr[N - 1], '\0');
return OneByteString(isolate, arr.data(), N - 1);
}

Expand Down
Loading