Skip to content

Instantly share code, notes, and snippets.

@engie
Created July 14, 2013 14:06
Show Gist options
  • Save engie/5994390 to your computer and use it in GitHub Desktop.
Save engie/5994390 to your computer and use it in GitHub Desktop.
An example of the Escalator project at work.
std::vector<int> a = { 3, 1, 4, 4, 2 };
std::vector<int> res6 = lift(a)
.zipWithIndex()
.filter( []( const std::pair<int, size_t>& v ) { return v.second > 0; } )
.map( []( const std::pair<int, size_t>& v ) { return v.first; } )
.toVec();
BOOST_CHECK_EQUAL( res6.size(), 4 );
CHECK_SAME_ELEMENTS( res6, std::vector<int> { 1, 4, 4, 2 } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment