summaryrefslogtreecommitdiff
path: root/include/fud_string_view.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fud_string_view.hpp')
-rw-r--r--include/fud_string_view.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/fud_string_view.hpp b/include/fud_string_view.hpp
index 2ced639..718b3d7 100644
--- a/include/fud_string_view.hpp
+++ b/include/fud_string_view.hpp
@@ -45,6 +45,12 @@ struct StringView {
{
}
+ template <size_t N>
+ StringView(const char (&input)[N]) : m_length{N - 1}, m_data{reinterpret_cast<const utf8*>(input)}
+ {
+ static_assert(N > 0);
+ }
+
StringView(size_t strLen, const char* strData) :
m_length(strLen), // line break
m_data{reinterpret_cast<const utf8*>(strData)} // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)