Horje
sort using comparator anonymous function c++ Code Example
sort using comparator anonymous function c++
sort(mMyClassVector.begin(), mMyClassVector.end(), 
    [](const MyClass & a, const MyClass & b) -> bool
{ 
    return a.mProperty > b.mProperty; 
});
sort using comparator anonymous function c++
#include<array>
#include<functional>

int main()
{
    std::array<int, 10> vec = { 1,2,3,4,5,6,7,8,9 };

    std::sort(std::begin(vec), 
              std::end(vec), 
              [](int a, int b) {return a > b; });

    for (auto item : vec)
      std::cout << item << " ";

    return 0;
}




Cpp

Related
what are manipulators in c++ Code Example what are manipulators in c++ Code Example
C++ Detect when user presses arrow key Code Example C++ Detect when user presses arrow key Code Example
product of array in cpp Code Example product of array in cpp Code Example
what is the format specifier for dword c++ Code Example what is the format specifier for dword c++ Code Example
how to seek to the start of afile in c++ Code Example how to seek to the start of afile in c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12