sstring: add static_assert to prevent use on >1 byte types

This commit is contained in:
Avi Kivity
2015-02-23 18:23:18 +02:00
parent 9519f04b0b
commit f730ae9814

View File

@@ -31,11 +31,17 @@
#include <iostream>
#include <functional>
#include <cstdio>
#include <type_traits>
#include <experimental/string_view>
#include "core/temporary_buffer.hh"
template <typename char_type, typename Size, Size max_size>
class basic_sstring {
static_assert(
(std::is_same<char_type, char>::value
|| std::is_same<char_type, signed char>::value
|| std::is_same<char_type, unsigned char>::value),
"basic_sstring only supports single byte char types");
union contents {
struct external_type {
char_type* str;