Created
March 24, 2015 12:43
-
-
Save c4tachan/baa16976162a72c00c45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct hasSmrtPtr | |
{ | |
vector<unique_pointer<int>> unq; | |
} hsSmrtPtr; | |
hsSmrtPtr g; | |
void smrtPtrScope(int len) | |
{ | |
for(int i = 0; i < len; ++i) | |
{ | |
g.unq.resize(g.size() + 1); | |
int* tmpPtr; | |
*tmpPtr = i; | |
g.unq.back().reset(tmpPtr); | |
} | |
} | |
void main() | |
{ | |
smrtPtrScope(5); | |
for(auto i : g.unq) | |
{ | |
std::cout << *(g.unq) << std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment