Home | History | Annotate | Download | only in back.insert.iter.op=
      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 // back_insert_iterator
     13 
     14 // requires CopyConstructible<Cont::value_type>
     15 //   back_insert_iterator<Cont>&
     16 //   operator=(Cont::value_type&& value);
     17 
     18 #include <iterator>
     19 
     20 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     21 
     22 #include <vector>
     23 #include <memory>
     24 #include <cassert>
     25 
     26 template <class C>
     27 void
     28 test(C c)
     29 {
     30     std::back_insert_iterator<C> i(c);
     31     i = typename C::value_type();
     32     assert(c.back() == typename C::value_type());
     33 }
     34 
     35 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     36 
     37 int main()
     38 {
     39 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     40     test(std::vector<std::unique_ptr<int> >());
     41 #endif
     42 }
     43