From 753f3a50d10e43134ebeb52b3ec0a10b7ec2b80a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 29 Jan 2017 13:49:45 +0000 Subject: Make StringView and unit types trivial types --- src/string.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/string.hh') diff --git a/src/string.hh b/src/string.hh index 8ce6ded5..14e92bd7 100644 --- a/src/string.hh +++ b/src/string.hh @@ -211,7 +211,7 @@ private: class StringView : public StringOps { public: - constexpr StringView() = default; + StringView() = default; constexpr StringView(const char* data, ByteCount length) : m_data{data}, m_length{length} {} constexpr StringView(const char* data) : m_data{data}, m_length{data ? strlen(data) : 0} {} @@ -248,10 +248,12 @@ public: ZeroTerminatedString zstr() const { return {begin(), end()}; } private: - const char* m_data = nullptr; - ByteCount m_length = 0; + const char* m_data; + ByteCount m_length; }; +static_assert(std::is_trivial::value, ""); + template inline StringView StringOps::substr(ByteCount from, ByteCount length) const { -- cgit v1.2.3