add a unique_ptr test

master
neingeist 11 years ago
parent 6b9a8e557d
commit 9f05ea4f04

@ -0,0 +1,18 @@
#include <cassert>
#include <iostream>
#include <memory>
#include <vector>
int main(void) {
std::vector<std::unique_ptr<int>> v;
std::unique_ptr<int> q(new int(42));
assert(q != NULL);
// v.push_back(q);
v.push_back(std::move(q));
assert(q == NULL);
for(auto &e: v) {
std::cout << *e << std::endl;
}
}
Loading…
Cancel
Save