Created
November 28, 2014 11:17
-
-
Save Mooophy/d9343e207918f9fe7c9a 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
| #include <iostream> | |
| #include <vector> | |
| #include <memory> | |
| int main() | |
| { | |
| //! (*v).push_back(),这样对vector似乎并不适用。 | |
| //! | |
| //! -- check the code blew | |
| auto p = std::make_shared<std::vector<int>>(); | |
| (*p).push_back(42); | |
| p->push_back(999); | |
| std::cout << (*p)[0] << " " << (*p)[1] << std::endl; | |
| return 0; | |
| } | |
| //! output: | |
| //! | |
| //42 999 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment