Implement LWG#2761: 'basic_string should require that charT match traits::char_type'. Tests for string_view, too

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2017-03-15 18:41:11 +00:00
parent e807cbcd5b
commit 2d4c3fa48a
5 changed files with 32 additions and 4 deletions

View File

@@ -199,6 +199,10 @@ public:
typedef ptrdiff_t difference_type;
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
static_assert(is_pod<value_type>::value, "Character type of basic_string_view must be a POD");
static_assert((is_same<_CharT, typename traits_type::char_type>::value),
"traits_type::char_type must be the same type as CharT");
// [string.view.cons], construct/copy
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}