Fix wrong implicit conversions from int/Codepoint to StringView
This commit is contained in:
parent
adaf6ecc40
commit
8439059758
|
@ -32,7 +32,7 @@ inline void option_from_string(StringView str, bool& opt)
|
|||
throw runtime_error("boolean values are either true, yes, false or no");
|
||||
}
|
||||
|
||||
constexpr Codepoint list_separator = ':';
|
||||
constexpr char list_separator = ':';
|
||||
|
||||
template<typename T, MemoryDomain domain>
|
||||
String option_to_string(const Vector<T, domain>& opt)
|
||||
|
@ -98,7 +98,7 @@ void option_from_string(StringView str, UnorderedMap<Key, Value, domain>& opt)
|
|||
}
|
||||
}
|
||||
|
||||
constexpr Codepoint tuple_separator = ',';
|
||||
constexpr char tuple_separator = ',';
|
||||
|
||||
template<size_t I, typename... Types>
|
||||
struct TupleOptionDetail
|
||||
|
|
|
@ -148,16 +148,22 @@ String expand_tabs(StringView line, CharCount tabstop, CharCount col)
|
|||
{
|
||||
String res;
|
||||
res.reserve(line.length());
|
||||
using Utf8It = utf8::iterator<const char*>;
|
||||
for (Utf8It it = line.begin(); it.base() < line.end(); ++it)
|
||||
for (auto it = line.begin(), end = line.end(); it != end; )
|
||||
{
|
||||
if (*it == '\t')
|
||||
{
|
||||
CharCount end_col = (col / tabstop + 1) * tabstop;
|
||||
res += String{' ', end_col - col};
|
||||
col = end_col;
|
||||
++it;
|
||||
}
|
||||
else
|
||||
res += *it;
|
||||
{
|
||||
auto char_end = utf8::next(it, end);
|
||||
res += {it, char_end};
|
||||
++col;
|
||||
it = char_end;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ public:
|
|||
constexpr StringView(const char* begin, const char* end) : m_data{begin}, m_length{(int)(end - begin)} {}
|
||||
StringView(const String& str) : m_data{str.data()}, m_length{(int)str.length()} {}
|
||||
StringView(const char& c) : m_data(&c), m_length(1) {}
|
||||
StringView(int c) = delete;
|
||||
|
||||
[[gnu::always_inline]]
|
||||
constexpr const char* data() const { return m_data; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user