Advertisement
rizky_herucakra

Test using Boost.Range

Jul 16th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  TestBoostRange
  4. //
  5. //  Created by Rizky Herucakra on 7/17/13.
  6. //  Copyright (c) 2013 Rizky Herucakra. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include "boost/range/algorithm/sort.hpp"
  11. #include "boost/range/adaptor/filtered.hpp"
  12.  
  13. using namespace std;
  14. using namespace boost;
  15. using namespace boost::adaptors;
  16.  
  17. int main(int argc, const char * argv[])
  18. {
  19.  
  20.     int arr[7] = {5,2,8,0,1,3,9};
  21.  
  22.     for (auto x : sort(arr)| filtered([](int v ){ return v % 2 == 0;})){
  23.         cout << x << " ";
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement