Skip to content

select with optional index parameter #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KN4CK3R
Copy link

@KN4CK3R KN4CK3R commented Mar 21, 2016

I implemented the second overload of the select operator which takes the index of the current element in the sequence.

https://msdn.microsoft.com/en-us/library/bb534869%28v=vs.110%29.aspx

Example:

std::vector<std::string> str = { "Value1", "Value2", "Value3" };
from(str)
        >> select([](auto&& s, auto&& i) { return std::make_pair(i, s); })
        >> for_each([](auto&& s) { std::cout << s.first << " = " << s.second << "\n"; });

prints

0 = Value1
1 = Value2
2 = Value3

@KN4CK3R
Copy link
Author

KN4CK3R commented Mar 21, 2016

added select_many too

@srvasn
Copy link

srvasn commented Sep 17, 2019

@KN4CK3R, ran into this while porting your SDK generator to ARM :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants