Skip to content

Instantly share code, notes, and snippets.

@lshort
Created May 25, 2014 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lshort/21f409f49918165e96c3 to your computer and use it in GitHub Desktop.
Save lshort/21f409f49918165e96c3 to your computer and use it in GitHub Desktop.
auto map = [] (const auto &function, const auto &container )
{
auto retval = container;
retval.clear();
for (const auto &elem : container)
retval.push_back(function(elem));
return retval;
};
vector<int> data {1,2,3,4};
vector<int> map_results = map(double_incr_decor,data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment