Friday, 15 May 2015

c++ - Is there and neat equivalent to view a member function/variable? -


To view a category by the member function

is a clean map function whether there is a similar view is?

What would see: transform? be the only option?

Example from the article:

  std :: vector widgets = * ... * / std :: set ids = stream :: MakeStream :: from (widgets) .map (& widget :: getId) .to_set (); Ignore random template arguments for  

( std :: vector and std :: set - v3 will:

  std :: vector & lt; widget & gt; widget = // ... std :: set & gt; widget :: id> id = widgets :: borders :: view :: Change (& widget :: getId);  

Yes, change is the equivalent of the map in the stream.

Accept all algorithms in category-v3 to allow algorithm to select category elements based on conversion For example, we can sort the widget by our code:

  widgets | = categories :: Action :: Sort (Study :: more :: Widget :: id> gt;;}, and Widget :: getId);  

No comments:

Post a Comment