We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2df4a88 commit 6819b55Copy full SHA for 6819b55
1 file changed
common/conststr.h
@@ -304,8 +304,13 @@ struct EnumStr : public Split {
304
template <typename Accum, typename Whole>
305
struct CompactStringArray {
306
constexpr static decltype(auto) whole() { return Whole(); }
307
+ constexpr static size_t size() { return Accum::size(); }
308
309
constexpr static std::string_view at(size_t i) {
310
+ if (i < 0 || i >= size()) return {};
311
+ return CompactStringArray<Accum, Whole>()[i];
312
+ }
313
+ constexpr std::string_view operator[](size_t i) {
314
return {&Whole::chars[Accum::arr[i] + i],
315
(size_t)Accum::arr[i + 1] - (size_t)Accum::arr[i]};
316
}
0 commit comments