Vultraz

Untitled

Aug 2nd, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. template<typename Fnc>
  2. void tgame_load::init_sorting_option(generator_sort_array& order_funcs, Fnc filter_on)
  3. {
  4.     order_funcs[0] = [this, &filter_on](unsigned i1, unsigned i2) {
  5.         return filter_on(games_[i1]) < filter_on(games_[i2]);
  6.     };
  7.  
  8.     order_funcs[1] = [this, &filter_on](unsigned i1, unsigned i2) {
  9.         return filter_on(games_[i1]) > filter_on(games_[i2]);
  10.     };
  11. }
  12.  
  13. // Calls
  14. generator_sort_array order_funcs;
  15.  
  16. init_sorting_option(order_funcs, std::bind(&savegame::save_info::name, _1));
  17. list.set_column_order(0, order_funcs);
  18.  
  19. init_sorting_option(order_funcs, std::bind(&savegame::save_info::modified, _1));
  20. list.set_column_order(1, order_funcs);
  21.  
  22. // Definition of games_
  23. std::vector<savegame::save_info> games_;
Add Comment
Please, Sign In to add comment