Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <cstdio>
- using namespace std;
- class A {
- public:
- A () { printf(" + %x\n", this); }
- virtual ~A () { printf(" - %x\n", this); };
- A(const A& rhs) { printf(" = %x -> %x\n", &rhs, this); };
- };
- int main(int argc, char const* argv[])
- {
- vector<A> a;
- for (int i = 0; i < 5; i++) {
- printf("push_back #%d\n", i);
- a.push_back(A());
- printf("vector base = %x\n", &a[0]);
- }
- return 0;
- }
- /*
- push_back #0
- + be763130
- = be763130 -> 1731010
- - be763130
- vector base = 1731010
- push_back #1
- + be763130
- = be763130 -> 1731038
- = 1731010 -> 1731030
- - 1731010
- - be763130
- vector base = 1731030
- push_back #2
- + be763130
- = be763130 -> 1731060
- = 1731030 -> 1731050
- = 1731038 -> 1731058
- - 1731030
- - 1731038
- - be763130
- vector base = 1731050
- push_back #3
- + be763130
- = be763130 -> 1731068
- - be763130
- vector base = 1731050
- push_back #4
- + be763130
- = be763130 -> 17310a0
- = 1731050 -> 1731080
- = 1731058 -> 1731088
- = 1731060 -> 1731090
- = 1731068 -> 1731098
- - 1731050
- - 1731058
- - 1731060
- - 1731068
- - be763130
- vector base = 1731080
- - 1731080
- - 1731088
- - 1731090
- - 1731098
- - 17310a0
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement