1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <algorithm>
#include <iostream>
enum xxx {
FOO = 3,
BAR,
};
struct empty {};
class A {
public:
A(empty e, enum xxx x, long i, const char *s)
: E(e)
, X(x)
, I(i)
, S(s)
{
volatile int dummy; // just not to be optimized
dummy++;
}
private:
empty E;
enum xxx X;
long I;
const char *S;
};
bool myless(int a, int b)
{
return a < b;
}
int main()
{
int x[5] = { 5, 3, 9, 2, 7 };
empty E;
A(E, FOO, BAR, "debug info test");
std::sort(x, x + 5, myless);
std::sort(x, x + 5, std::less<int>());
std::sort(x, x + 5, [](int a, int b) { return a < b; });
return 0;
}
|