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 | // <list> |
| 11 | |
| 12 | // template <class... Args> void emplace_front(Args&&... args); |
| 13 | |
| 14 | #include <list> |
| 15 | #include <cassert> |
| 16 | |
| 17 | class A |
| 18 | { |
| 19 | int i_; |
| 20 | double d_; |
| 21 | |
| 22 | A(const A&); |
| 23 | A& operator=(const A&); |
| 24 | public: |
| 25 | A(int i, double d) |
| 26 | : i_(i), d_(d) {} |
| 27 | |
| 28 | int geti() const {return i_;} |
| 29 | double getd() const {return d_;} |
| 30 | }; |
| 31 | |
| 32 | int main() |
| 33 | { |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 34 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 35 | std::list<A> c; |
| 36 | c.emplace_front(2, 3.5); |
| 37 | assert(c.size() == 1); |
| 38 | assert(c.front().geti() == 2); |
| 39 | assert(c.front().getd() == 3.5); |
| 40 | c.emplace_front(3, 4.5); |
| 41 | assert(c.size() == 2); |
| 42 | assert(c.front().geti() == 3); |
| 43 | assert(c.front().getd() == 4.5); |
| 44 | assert(c.back().geti() == 2); |
| 45 | assert(c.back().getd() == 3.5); |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 46 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 47 | } |