Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Howard Hinnant | 712522c | 2010-08-22 00:29:01 +0000 | [diff] [blame] | 15 | // back_insert_iterator<Cont>& |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 16 | // operator=(Cont::value_type&& value); |
| 17 | |
| 18 | #include <iterator> |
| 19 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 20 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 35 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 36 | |
| 37 | int main() |
| 38 | { |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 39 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 40 | test(std::vector<std::unique_ptr<int> >()); |
| 41 | #endif |
| 42 | } |