#include "../c++/distance/meter.hpp" #include "../c++/time/second.hpp" #include "../c++/unit_print.hpp" #include int main(){ /** * The definition is a bit convoluted, so I leave it in the hands of the headers themselves and define a convenience alias for the user. * meter e.g. is defined by * * namespace unit_type { * struct meter {}; * } * template * using meter = unit>; * * which then can be used as follows */ using scalar = kel::scalar; using meter = kel::meter; using square_meter = kel::square_meter; using second = kel::second; meter a = 6.f; meter b = 3.f; second s = 10.f; // Since it is not compileable I cannot show it, but c + s would throw a compilation error. meter c = a+b; meter d = a-b; // Auto deduced type. Based on the template parameters automatically stitches together a valid unit auto mps = b / s; // Technically auto deduced, but predefined for convenience. square_meter e = a*b; // scalar f = a/b; std::cout<<"Values:\n"; std::cout<<"a: "<