rv_value.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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=(Cont::value_type&& value);
16
17#include <iterator>
18
19#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
20
21#include <list>
22#include <memory>
23#include <cassert>
24
25template <class C>
26void
27test(C c)
28{
29    std::front_insert_iterator<C> i(c);
30    i = typename C::value_type();
31    assert(c.front() == typename C::value_type());
32}
33
34#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
35
36int main()
37{
38#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
39    test(std::list<std::unique_ptr<int> >());
40#endif
41}
42