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 // <list> 11 12 // template <class... Args> void emplace_back(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 { 34 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 35 std::list<A> c; 36 c.emplace_back(2, 3.5); 37 assert(c.size() == 1); 38 assert(c.front().geti() == 2); 39 assert(c.front().getd() == 3.5); 40 c.emplace_back(3, 4.5); 41 assert(c.size() == 2); 42 assert(c.front().geti() == 2); 43 assert(c.front().getd() == 3.5); 44 assert(c.back().geti() == 3); 45 assert(c.back().getd() == 4.5); 46 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 47 } 48