summaryrefslogtreecommitdiff
path: root/include/fud_string_view.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-25 01:09:10 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-25 01:09:10 -0500
commit11968f674a7de34fb7de744598a8086330cd88a3 (patch)
treebe5b885ef47c8ceab50f558c8aef6632fefc94d1 /include/fud_string_view.hpp
parent512d026de016f2720060d264adec02e56123851d (diff)
Get working string formatting for unsigned numbers.
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)