#include <deque>
#include <iostream>
struct X {
std::string name_;
size_t id_;
};
int main(void) {
std::deque<X> dx;
dx.push_back({"X0", 0});
dx.push_back({"X1", 1});
std::cout << "{" << dx.front().name_ << ", " << dx.front().id_ << "}\n";
// {X0, 0}
auto &rx = dx.front();
rx.name_ = "X2";
rx.id_ = 2;
std::cout << "{" << dx.front().name_ << ", " << dx.front().id_ << "}\n";
// {X2, 2}
return 0;
}
【 在 RGB 的大作中提到: 】
: 好的,稍晚些时候我写个小的测试程序
:
--
修改:jtcheng FROM 223.71.29.*
FROM 223.71.29.*