blob: cdca9bf4becba5c4b5587ad43d94628873bd9005 [file] [log] [blame]
Dan Albert287553d2017-02-16 10:47:51 -08001//===----------------------------------------------------------------------===//
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#include "nasty_containers.hpp"
21
22template <class C>
23void
24test(C c)
25{
26 const typename C::value_type v = typename C::value_type();
27 std::front_insert_iterator<C> i(c);
28 i = v;
29 assert(c.front() == v);
30}
31
32class Copyable
33{
34 int data_;
35public:
36 Copyable() : data_(0) {}
37 ~Copyable() {data_ = -1;}
38
39 friend bool operator==(const Copyable& x, const Copyable& y)
40 {return x.data_ == y.data_;}
41};
42
43int main()
44{
45 test(std::list<Copyable>());
46 test(nasty_list<Copyable>());
47}