chore: Add course material

This commit is contained in:
2026-10-05 11:27:21 +02:00
parent 971813c351
commit e8241fd1ff
660 changed files with 26658 additions and 1 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef Pixel_h
#define Pixel_h
#include <functional>
#include <iostream>
class Pixel {
public:
Pixel(int x = 0, int y = 0) : x(x), y(y) {}
void print() const { std::cout << '(' << x << "," << y << ") "; }
bool operator<(const Pixel &rhs) const { return x < rhs.x; }
bool operator==(const Pixel &rhs) const { return x == rhs.x; }
private:
int x;
int y;
friend class PixelPtrCompare;
};
class PixelPtrCompare {
public:
PixelPtrCompare() : sortOnY(false) {}
void setSortOnY(bool sortY) { this->sortOnY = sortY; }
bool operator()(const Pixel *l, const Pixel *r) const {
if (sortOnY) {
return l->y < r->y;
} else {
return l->x < r->x;
}
}
private:
bool sortOnY;
};
#endif