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 // <vector> 11 12 // iterator begin(); 13 // iterator end(); 14 // const_iterator begin() const; 15 // const_iterator end() const; 16 // const_iterator cbegin() const; 17 // const_iterator cend() const; 18 19 #include <vector> 20 #include <cassert> 21 #include <iterator> 22 23 int main() 24 { 25 { 26 typedef bool T; 27 typedef std::vector<T> C; 28 C c; 29 C::iterator i = c.begin(); 30 C::iterator j = c.end(); 31 assert(std::distance(i, j) == 0); 32 assert(i == j); 33 } 34 { 35 typedef bool T; 36 typedef std::vector<T> C; 37 const C c; 38 C::const_iterator i = c.begin(); 39 C::const_iterator j = c.end(); 40 assert(std::distance(i, j) == 0); 41 assert(i == j); 42 } 43 { 44 typedef bool T; 45 typedef std::vector<T> C; 46 C c; 47 C::const_iterator i = c.cbegin(); 48 C::const_iterator j = c.cend(); 49 assert(std::distance(i, j) == 0); 50 assert(i == j); 51 assert(i == c.end()); 52 } 53 { 54 typedef bool T; 55 typedef std::vector<T> C; 56 C::iterator i; 57 C::const_iterator j; 58 } 59 } 60