diff options
| author | 2026-11-10 08:29:58 +0000 | |
|---|---|---|
| committer | 2026-11-10 08:33:56 +0000 | |
| commit | 776276d5c7e67356a880f3e31076d32cdc1c1882 (patch) | |
| tree | cbde131f3d46338adee9c67ac0f988295736bdd4 /src/string-view.h | |
| download | coursework-master.tar.gz | |
Diffstat (limited to 'src/string-view.h')
| -rw-r--r-- | src/string-view.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/string-view.h b/src/string-view.h new file mode 100644 index 0000000..3ebebc0 --- /dev/null +++ b/src/string-view.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | // string-view.h | ||
| 2 | #ifndef INCLUDED_STRING_VIEW_H | ||
| 3 | #define INCLUDED_STRING_VIEW_H | ||
| 4 | |||
| 5 | #define STRING_VIEW__LENGTH(SV) ((SV).end - (SV).begin) | ||
| 6 | |||
| 7 | #define STRING_VIEW__FMT "%.*s" | ||
| 8 | #define STRING_VIEW__FMTA(SV) (int) STRING_VIEW__LENGTH (SV), (SV).begin | ||
| 9 | |||
| 10 | struct string_view { | ||
| 11 | const char *begin; | ||
| 12 | const char *end; | ||
| 13 | }; | ||
| 14 | |||
| 15 | #endif // INCLUDED_STRING_VIEW_H | ||
| 16 | // string-view.h ends here | ||
