Skip to content

Commit

Permalink
Strengthen unit aliases (#150)
Browse files Browse the repository at this point in the history
* Run clang-format

* Expand `traits::strong` to work with `unit`s

* Add `UNIT_ADD_STRONG` for specializing `traits::strong`

* Add `traits::unit_base` type trait

* Add `UNIT_ADD_HASH` for specializing `std::hash`

* Add `UNIT_ADD_COMMON_TYPE` for specializing `std::common_type`

* Add macros grouping the macros for specializing templates

* Handle assignment from arithmetic like compound assignment

That is, convert to the underlying type in the caller.

* Make `is_`*`_unit` work with strong units

* Add `traits::replace_underlying` type trait

* Fix `is_non_lossy_convertible_unit`

* Account for strong units in the compound assignment operators

* Account for strong units in the unary operators

* Account for strong units in the binary arithmetic operators

* Account for strong units in the power functions

* Account for strong units in the decibel arithmetic operators

* Account for strong units in the trascendental functions

* Remove superfluous `traits::strong` partial specialization

* Add `UNIT_ADD_SCALED_UNIT_DEFINITION`

* Strengthen `dimensionless`

* Strengthen `dB_t`

* Strengthen decibel units

* Strengthen linear units

* Test CTAD

* VS2017 fix attempt

* Update documentation based on `conversion_factor` rename

* Fix macro documentation

* Avoid manual macro expansion

Modifies macros to allow arbitrary units.
Also adds missing `UNIT_ADD_STRONG` for `dB_t`.

* Add deduction guide for default constructor
  • Loading branch information
JohelEGP authored and nholthaus committed Oct 30, 2018
1 parent dca7db2 commit 1634c78
Show file tree
Hide file tree
Showing 2 changed files with 920 additions and 249 deletions.
Loading

0 comments on commit 1634c78

Please sign in to comment.