//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // // template _End> // basic_string_view(_It, _End) -> basic_string_view>; #include #include #include "make_string.h" #include "test_macros.h" #include "test_iterators.h" template constexpr void test_ctad(std::basic_string_view val) { auto sv = std::basic_string_view(It(val.data()), Sentinel(It(val.data() + val.size()))); ASSERT_SAME_TYPE(decltype(sv), std::basic_string_view); assert(sv.data() == val.data()); assert(sv.size() == val.size()); } template constexpr void test_with_char() { const auto val = MAKE_STRING_VIEW(CharT, "test"); test_ctad(val); test_ctad(val); test_ctad(val); test_ctad>(val); test_ctad, contiguous_iterator>(val); test_ctad, sized_sentinel>>(val); } constexpr void test() { test_with_char(); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test_with_char(); #endif test_with_char(); test_with_char(); test_with_char(); } int main(int, char**) { test(); return 0; }