Advertisement
dooly386

std::sort lambda function

May 16th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1.         auto f = [](const c_appevent &a,const c_appevent &b)->bool
  2.         {
  3.             if(a.m_priority < b.m_priority) return true;
  4.             if(a.m_priority == b.m_priority) return a.idx<b.idx;
  5.             return false;
  6.         };
  7.  
  8.         std::sort(evts.begin(),evts.end(),f);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement