Home | History | Annotate | Download | only in string.iterators
      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 
     24 int 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     { // N3644 testing
     51         typedef std::u16string C;
     52         C::iterator ii1{}, ii2{};
     53         C::iterator ii4 = ii1;
     54         C::const_iterator cii{};
     55         assert ( ii1 == ii2 );
     56         assert ( ii1 == ii4 );
     57         assert ( ii1 == cii );
     58         assert ( !(ii1 != ii2 ));
     59         assert ( !(ii1 != cii ));
     60     }
     61 
     62     { // N3644 testing
     63         typedef std::u32string C;
     64         C::iterator ii1{}, ii2{};
     65         C::iterator ii4 = ii1;
     66         C::const_iterator cii{};
     67         assert ( ii1 == ii2 );
     68         assert ( ii1 == ii4 );
     69         assert ( ii1 == cii );
     70         assert ( !(ii1 != ii2 ));
     71         assert ( !(ii1 != cii ));
     72     }
     73 }
     74