xo-unit: example: + ex4 .. ex6
This commit is contained in:
parent
7c7373427e
commit
ba31d2c112
7 changed files with 116 additions and 0 deletions
15
example/ex6/CMakeLists.txt
Normal file
15
example/ex6/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# xo-unit/example/ex6/CMakeLists.txt
|
||||
|
||||
set(SELF_EXE xo_unit_ex6)
|
||||
set(SELF_SRCS ex6.cpp)
|
||||
|
||||
add_executable(${SELF_EXE} ${SELF_SRCS})
|
||||
xo_include_options2(${SELF_EXE})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# dependencies..
|
||||
|
||||
xo_self_dependency(${SELF_EXE} xo_unit)
|
||||
xo_dependency(${SELF_EXE} reflect)
|
||||
|
||||
# end CMakeLists.txt
|
||||
19
example/ex6/ex6.cpp
Normal file
19
example/ex6/ex6.cpp
Normal 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 */
|
||||
Loading…
Add table
Add a link
Reference in a new issue