1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 10 11 // <string> 12 13 // bool starts_with(charT x) const noexcept; 14 15 #include <string> 16 #include <cassert> 17 18 #include "test_macros.h" 19 20 int main() 21 { 22 { 23 typedef std::string S; 24 S s1 {}; 25 S s2 { "abcde", 5 }; 26 27 ASSERT_NOEXCEPT(s1.starts_with('e')); 28 29 assert (!s1.starts_with('a')); 30 assert (!s1.starts_with('x')); 31 assert ( s2.starts_with('a')); 32 assert (!s2.starts_with('x')); 33 } 34 } 35