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 // <forward_list> 11 12 // void unique(); 13 14 #include <forward_list> 15 #include <iterator> 16 #include <cassert> 17 18 int main() 19 { 20 { 21 typedef int T; 22 typedef std::forward_list<T> C; 23 const T t1[] = {0, 5, 5, 0, 0, 0, 5}; 24 const T t2[] = {0, 5, 0, 5}; 25 C c1(std::begin(t1), std::end(t1)); 26 C c2(std::begin(t2), std::end(t2)); 27 c1.unique(); 28 assert(c1 == c2); 29 } 30 { 31 typedef int T; 32 typedef std::forward_list<T> C; 33 const T t1[] = {0, 0, 0, 0}; 34 const T t2[] = {0}; 35 C c1(std::begin(t1), std::end(t1)); 36 C c2(std::begin(t2), std::end(t2)); 37 c1.unique(); 38 assert(c1 == c2); 39 } 40 { 41 typedef int T; 42 typedef std::forward_list<T> C; 43 const T t1[] = {5, 5, 5}; 44 const T t2[] = {5}; 45 C c1(std::begin(t1), std::end(t1)); 46 C c2(std::begin(t2), std::end(t2)); 47 c1.unique(); 48 assert(c1 == c2); 49 } 50 { 51 typedef int T; 52 typedef std::forward_list<T> C; 53 C c1; 54 C c2; 55 c1.unique(); 56 assert(c1 == c2); 57 } 58 { 59 typedef int T; 60 typedef std::forward_list<T> C; 61 const T t1[] = {5, 5, 5, 0}; 62 const T t2[] = {5, 0}; 63 C c1(std::begin(t1), std::end(t1)); 64 C c2(std::begin(t2), std::end(t2)); 65 c1.unique(); 66 assert(c1 == c2); 67 } 68 } 69