當我在閱讀http://thbecker.net/articles/rvalue_references/section_01.html時,我得到了以下snippiest。 // lvalues:
//
int i = 42;
i = 43; // ok, i is an lvalue
int& foo();
foo() = 42; // ok, foo() is an lvalue
i
我想再次做一些奇怪的事情。 好的,這裏是一般的想法。我想要一個std::list(和vector等),它們實際上擁有它們包含的對象。我想將的值移入它,並通過引用訪問它們。 例使用的unique_ptr的列表: using namespace std;
list<unique_ptr<T>> items; // T is whatever type
items.push_back(make_u