Skip to content

Commit

Permalink
xo-unit: fixup ex5 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rconybea committed May 20, 2024
1 parent 8c09ee4 commit 3b2fa29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/ex5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ xo_add_executable(${SELF_EXE} ${SELF_SRCS})
# dependencies..

xo_self_headeronly_dependency(${SELF_EXE} xo_unit)
#xo_dependency(${SELF_EXE} reflect)
xo_dependency(${SELF_EXE} xo_flatstring)

# end CMakeLists.txt
11 changes: 6 additions & 5 deletions example/ex5/ex5.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/** @file ex5.cpp **/

#include "xo/unit/mpl/quantity.hpp"
#include "xo/unit/quantity.hpp"
#include "xo/unit/quantity_iostream.hpp"
#include <iostream>

int
main () {
namespace u = xo::unit::units;
namespace qty = xo::unit::qty;
//namespace u = xo::unit::units;
namespace q = xo::qty::qty;
using namespace std;

/* 20% volatility over 250 days (approx number of trading days in one year) */
auto q1 = qty::volatility250d(0.2);
auto q1 = q::volatility_250d(0.2);
/* 10% volatility over 30 days */
auto q2 = qty::volatility30d(0.1);
auto q2 = q::volatility_30d(0.1);

auto sum = q1 + q2;
auto prod = q1 * q2;
Expand Down

0 comments on commit 3b2fa29

Please sign in to comment.