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 // <iterator> 11 12 // front_insert_iterator 13 14 // front_insert_iterator<Cont>& 15 // operator=(const Cont::value_type& value); 16 17 #include <iterator> 18 #include <list> 19 #include <cassert> 20 21 template <class C> 22 void 23 test(C c) 24 { 25 const typename C::value_type v = typename C::value_type(); 26 std::front_insert_iterator<C> i(c); 27 i = v; 28 assert(c.front() == v); 29 } 30 31 class Copyable 32 { 33 int data_; 34 public: 35 Copyable() : data_(0) {} 36 ~Copyable() {data_ = -1;} 37 38 friend bool operator==(const Copyable& x, const Copyable& y) 39 {return x.data_ == y.data_;} 40 }; 41 42 int main() 43 { 44 test(std::list<Copyable>()); 45 } 46