Skip to content

Commit

Permalink
docs: "Value-truncating conversions" chapter updated as value_cast
Browse files Browse the repository at this point in the history
…now properly works on quantity points
  • Loading branch information
mpusz committed Jan 8, 2024
1 parent 4690a84 commit 01dbd02
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/users_guide/framework_basics/value_conversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ the `value_cast<U, Rep>(q)` which always returns the most precise result:

} // namespace unit_symbols

using Price = quantity<currency[us_dollar], double>;
using Scaled = quantity<currency[scaled_us_dollar], std::int64_t>;
using Price = quantity_point<currency[us_dollar]>;
using Scaled = quantity_point<currency[scaled_us_dollar], zeroth_point_origin<currency>, std::int64_t>;

Price price = 12.95 * USD;
Price price{12.95 * USD};
Scaled spx = value_cast<USD_s, std::int64_t>(price);
```

Expand All @@ -121,10 +121,10 @@ the `value_cast<U, Rep>(q)` which always returns the most precise result:

} // namespace unit_symbols

using Price = quantity<currency[us_dollar], double>;
using Scaled = quantity<currency[scaled_us_dollar], std::int64_t>;
using Price = quantity_point<currency[us_dollar]>;
using Scaled = quantity_point<currency[scaled_us_dollar], zeroth_point_origin<currency>, std::int64_t>;

Price price = 12.95 * USD;
Price price{12.95 * USD};
Scaled spx = value_cast<USD_s, std::int64_t>(price);
```

Expand All @@ -144,9 +144,9 @@ the `value_cast<U, Rep>(q)` which always returns the most precise result:

} // namespace unit_symbols

using Price = quantity<currency[us_dollar], double>;
using Scaled = quantity<currency[scaled_us_dollar], std::int64_t>;
using Price = quantity_point<currency[us_dollar]>;
using Scaled = quantity_point<currency[scaled_us_dollar], zeroth_point_origin<currency>, std::int64_t>;

Price price = 12.95 * USD;
Price price{12.95 * USD};
Scaled spx = value_cast<USD_s, std::int64_t>(price);
```

0 comments on commit 01dbd02

Please sign in to comment.