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 10 // <string> 11 12 // template<class charT, class traits, class Allocator> 13 // bool operator!=(const basic_string<charT, traits, Allocator> &lhs, basic_string_view<charT,traits> rhs); 14 // template<class charT, class traits, class Allocator> 15 // bool operator!=(basic_string_view<charT,traits> lhs, const basic_string<charT, traits, Allocator> &rhs); 16 17 #include <string_view> 18 #include <string> 19 #include <cassert> 20 21 template <class S> 22 void 23 test(const std::string &lhs, S rhs, bool x) 24 { 25 assert((lhs != rhs) == x); 26 assert((rhs != lhs) == x); 27 } 28 29 int main() 30 { 31 { 32 typedef std::string_view S; 33 test("", S(""), false); 34 test("", S("abcde"), true); 35 test("", S("abcdefghij"), true); 36 test("", S("abcdefghijklmnopqrst"), true); 37 test("abcde", S(""), true); 38 test("abcde", S("abcde"), false); 39 test("abcde", S("abcdefghij"), true); 40 test("abcde", S("abcdefghijklmnopqrst"), true); 41 test("abcdefghij", S(""), true); 42 test("abcdefghij", S("abcde"), true); 43 test("abcdefghij", S("abcdefghij"), false); 44 test("abcdefghij", S("abcdefghijklmnopqrst"), true); 45 test("abcdefghijklmnopqrst", S(""), true); 46 test("abcdefghijklmnopqrst", S("abcde"), true); 47 test("abcdefghijklmnopqrst", S("abcdefghij"), true); 48 test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); 49 } 50 } 51