#pragma once #include "utils/option.hpp" // Defines Including as [ and Excluding < for ranges. enum BorderType { Including = 0, Excluding = 1, }; template class Border { public: Border() : key(Option()), type(Including) {} Border(T Tey, BorderType type) : key(Option(std::move(key))), type(type) { } // Border(Border &other) = default; Border(Border &other) = default; Border(Border &&other) = default; Border &operator=(Border &&other) = default; Border &operator=(Border &other) = default; // true if no border or this > key or this >= key depends on border type. bool operator>(const T &other) const { return !key.is_present() || key.get() > other || (type == Including && key.get() == other); } // true if no border or this < key or this <= key depends on border type. bool operator<(const T &other) const { return !key.is_present() || key.get() < other || (type == Including && key.get() == other); } Option key; const BorderType type; }; template auto make_inf_border() { return Border(); }