练习12.7

···

include

include

include

using namespace std;

shared_ptr> new_vector(void) {
return make_shared>();
}
void read_ints(shared_ptr> spv) {
int v;
while (cin >> v) {
spv->push_back(v);
}
}
void print_ints(shared_ptr> spv) {
for (const auto &v : *spv) {
cout << v << " ";
}
cout << endl;
}
int main(int argc, char **argv)
{
auto spv = new_vector();
read_ints(spv);
print_ints(spv);
return 0;
}
···

你可能感兴趣的:(练习12.7)