xo-tokenizer: feat: + span.from_cstr()
This commit is contained in:
parent
dabc642ca4
commit
f57d23fef0
1 changed files with 8 additions and 0 deletions
|
|
@ -24,6 +24,14 @@ namespace xo {
|
|||
/** @brief create span for the contiguous memory range [@p lo, @p hi) **/
|
||||
span(CharT * lo, CharT * hi) : lo_{lo}, hi_{hi} {}
|
||||
|
||||
/** @brief create span for C-style string @p cstr **/
|
||||
static span from_cstr(const CharT * cstr) {
|
||||
CharT * lo = cstr;
|
||||
CharT * hi = cstr ? cstr + strlen(cstr) : nullptr;
|
||||
|
||||
return span(lo, hi);
|
||||
}
|
||||
|
||||
///@{
|
||||
|
||||
/** @name getters **/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue