1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
13 // constexpr basic_string_view(const _CharT* _s)
14 // : __data (_s), __size(_Traits::length(_s)) {}
17 #include <experimental/string_view>
21 #include "constexpr_char_traits.hpp"
23 template<typename CharT>
24 size_t StrLen ( const CharT *s ) {
26 while ( *s != 0 ) { ++retVal; ++s; }
30 template<typename CharT>
31 void test ( const CharT *s ) {
32 std::experimental::basic_string_view<CharT> sv1 ( s );
33 assert ( sv1.size() == StrLen( s ));
34 assert ( sv1.data() == s );
48 #if __cplusplus >= 201103L
58 #if _LIBCPP_STD_VER > 11
60 constexpr std::experimental::basic_string_view<char, constexpr_char_traits<char>> sv1 ( "ABCDE" );
61 static_assert ( sv1.size() == 5, "");