xo-unit: example: + ex4 .. ex6

This commit is contained in:
Roland Conybeare 2024-04-03 17:25:20 -04:00
commit ba31d2c112
7 changed files with 116 additions and 0 deletions

19
example/ex6/ex6.cpp Normal file
View file

@ -0,0 +1,19 @@
/** @file ex6.cpp **/
#include "xo/unit/quantity.hpp"
#include <iostream>
int
main () {
namespace u = xo::unit::units;
namespace qty = xo::unit::qty;
using namespace std;
auto t1 = qty::milliseconds(25.0);
auto t1_usec = t1.with_unit<u::microsecond>();
auto t1_sec = t1.with_unit<u::second>();
cerr << "t1: " << t1 << ", t1_usec: " << t1_usec << ", t1_sec: " << t1_sec << endl;
}
/** end ex6.cpp */