Closed saxbophone closed 1 year ago
Consider using interval syntax for std::cout
: https://en.wikipedia.org/wiki/Interval_(mathematics)#Terminology
Here's some helpful info on how to support the same interface that tuple/pair use: https://dominikberner.ch/structured-bindings/
This may be more idiomatic in the long run than passing around
std::pair<>
objects.We can even call the members
floor
andceil
for maximum idiomaticness.Also should provide a templated converting constructor for converting from instances of this template on other types, so we can take advantage of say automatic casting from
Nat <-> Int
without needing to special-case them.This should naturally, support the same tuple item-getter interface of
std::pair
andstd::tuple
, so we can still use our replacement type with structured bindings. With this in mind, we would do best to not change our existing tests to useInterval
explicitly, and instead keep the structured bindings usage: https://stackoverflow.com/a/37188019/6177253