Advertisement
Vultraz

Untitled

Feb 17th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1.     template<typename Ret>
  2.     void register_sorting_option(const int col, std::function<Ret(int, int)> f)
  3.     {
  4.         set_column_order(col, {{
  5.             [f](int lhs, int rhs) { return f(lhs) < f(rhs); },
  6.             [f](int lhs, int rhs) { return f(lhs) > f(rhs); }
  7.         }});
  8.     }
  9.  
  10.     template<>
  11.     void register_sorting_option(const int col, std::function<bool(int, int)> f)
  12.     {
  13.         set_column_order(col, {{
  14.             [f](int lhs, int rhs) { return f(rhs, lhs); },
  15.             [f](int lhs, int rhs) { return f(lhs, rhs); }
  16.         }});
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement