xo-unit: ex1: + static assert
This commit is contained in:
parent
fdd80f9d5f
commit
4d823595fe
1 changed files with 4 additions and 0 deletions
|
|
@ -5,13 +5,17 @@
|
|||
|
||||
int
|
||||
main () {
|
||||
namespace u = xo::unit::units;
|
||||
namespace qty = xo::unit::qty;
|
||||
using xo::unit::quantity;
|
||||
using namespace std;
|
||||
|
||||
auto t = qty::milliseconds(10);
|
||||
auto m = qty::kilograms(2.5);
|
||||
auto a = m / (t*t);
|
||||
|
||||
static_assert(same_as<decltype(t), quantity<u::millisecond, int>>);
|
||||
|
||||
cerr << "t: " << t << ", m: " << m << ", m.t^-2: " << a << endl;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue