rv_value.pass.cpp revision 73d21a4f0774d3fadab98e690619a359cfb160a3
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. 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 26template <class C> 27void 28test(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 37int main() 38{ 39#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 40 test(std::vector<std::unique_ptr<int> >()); 41#endif 42} 43