Created
May 28, 2015 02:52
-
-
Save theidexisted/e42f233e7fc2e051942d 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
| void foo(int argc, const char* argv[]) { | |
| while (argc--) | |
| std::cout << *argv++ << ' '; | |
| } | |
| int main() | |
| { | |
| std::vector<std::string> vec {"1", "2", "3", "4"}; | |
| std::vector<const char*> vecptr; | |
| std::transform(std::begin(vec), std::end(vec), std::back_inserter(vecptr), | |
| [](auto& s) { return s.c_str(); }); | |
| foo(vecptr.size(), &vecptr[0]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment