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 // UNSUPPORTED: c++98, c++03, c++11 11 12 // <string> 13 14 // iterator begin(); 15 // iterator end(); 16 // const_iterator begin() const; 17 // const_iterator end() const; 18 // const_iterator cbegin() const; 19 // const_iterator cend() const; 20 21 #include <string> 22 #include <cassert> 23 main()24int main() 25 { 26 { // N3644 testing 27 typedef std::string C; 28 C::iterator ii1{}, ii2{}; 29 C::iterator ii4 = ii1; 30 C::const_iterator cii{}; 31 assert ( ii1 == ii2 ); 32 assert ( ii1 == ii4 ); 33 assert ( ii1 == cii ); 34 assert ( !(ii1 != ii2 )); 35 assert ( !(ii1 != cii )); 36 } 37 38 { // N3644 testing 39 typedef std::wstring C; 40 C::iterator ii1{}, ii2{}; 41 C::iterator ii4 = ii1; 42 C::const_iterator cii{}; 43 assert ( ii1 == ii2 ); 44 assert ( ii1 == ii4 ); 45 assert ( ii1 == cii ); 46 assert ( !(ii1 != ii2 )); 47 assert ( !(ii1 != cii )); 48 } 49 50 #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L 51 { 52 typedef std::u8string C; 53 C::iterator ii1{}, ii2{}; 54 C::iterator ii4 = ii1; 55 C::const_iterator cii{}; 56 assert ( ii1 == ii2 ); 57 assert ( ii1 == ii4 ); 58 assert ( ii1 == cii ); 59 assert ( !(ii1 != ii2 )); 60 assert ( !(ii1 != cii )); 61 } 62 #endif 63 64 { // N3644 testing 65 typedef std::u16string C; 66 C::iterator ii1{}, ii2{}; 67 C::iterator ii4 = ii1; 68 C::const_iterator cii{}; 69 assert ( ii1 == ii2 ); 70 assert ( ii1 == ii4 ); 71 assert ( ii1 == cii ); 72 assert ( !(ii1 != ii2 )); 73 assert ( !(ii1 != cii )); 74 } 75 76 { // N3644 testing 77 typedef std::u32string C; 78 C::iterator ii1{}, ii2{}; 79 C::iterator ii4 = ii1; 80 C::const_iterator cii{}; 81 assert ( ii1 == ii2 ); 82 assert ( ii1 == ii4 ); 83 assert ( ii1 == cii ); 84 assert ( !(ii1 != ii2 )); 85 assert ( !(ii1 != cii )); 86 } 87 } 88