dont include the null byte
This commit is contained in:
parent
92eee153f2
commit
57d7178e76
@ -6,14 +6,14 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
struct CM_InternalStringView {
|
struct CM_InternalStringView final {
|
||||||
const char* start {nullptr};
|
const char* start {nullptr};
|
||||||
uint64_t extend {0};
|
uint64_t extend {0};
|
||||||
|
|
||||||
// conversion helpers
|
// conversion helpers
|
||||||
CM_InternalStringView(const std::string_view sv) : start(sv.data()), extend(sv.size()) {}
|
CM_InternalStringView(const std::string_view sv) : start(sv.data()), extend(sv.size()) {}
|
||||||
template<std::size_t N>
|
template<std::size_t N>
|
||||||
CM_InternalStringView(const char (&str)[N]) : start(str), extend(N) {}
|
CM_InternalStringView(const char (&str)[N]) : start(str), extend(N-1u) {}
|
||||||
CM_InternalStringView(const std::string& str) : start(str.data()), extend(str.size()) {}
|
CM_InternalStringView(const std::string& str) : start(str.data()), extend(str.size()) {}
|
||||||
operator std::string() { return {start, start+extend}; }
|
operator std::string() { return {start, start+extend}; }
|
||||||
operator std::string_view() { return {start, extend}; }
|
operator std::string_view() { return {start, extend}; }
|
||||||
|
Loading…
Reference in New Issue
Block a user