xo-unit: docs: + example programs

This commit is contained in:
Roland Conybeare 2024-04-02 17:29:35 -04:00
commit 0d9fd75b0c
8 changed files with 103 additions and 0 deletions

20
example/ex2/ex2.cpp Normal file
View file

@ -0,0 +1,20 @@
/** @file ex2.cpp **/
#include "xo/unit/quantity.hpp"
#include <iostream>
int
main () {
namespace u = xo::obs::units;
namespace qty = xo::obs::qty;
using xo::obs::quantity;
using namespace std;
quantity<u::second> t = qty::milliseconds(10);
quantity<u::gram> m = qty::kilograms(2.5);
auto a = m / (t*t);
cerr << "t: " << t << ", m: " << m << ", m.t^-2: " << a << endl;
}
/** end ex2.cpp **/