A C++14-compatible physical units library with no dependencies and a single-file delivery option. Emphasis on safety, accessibility, performance, and developer experience.
Apache License 2.0
329
stars
21
forks
source link
Add forward declarations for individual units #314
Individual "au/units/*.hh" files still pull in some decently heavy
machinery. The sensible, scalable solution is to provide a
"au/units/*_fwd.hh" file corresponding to each of them. Each
"regular" units header will include its _fwd.hh header as the first
include (and we add a comment to that effect to prevent clang-format
from reordering them).
Happily, this enables us to write a somewhat meaningful test for the
forward declaraction machinery. We can now make a header file that
provides an interface with only the forward declarations. Then we call
that API inside of a test file.
Finally, this is worth updating the docs for:
Installation: mention the fwd.hh files.
Alternatives: mention this feature, as we're the first units
library I know of that provides it.
All of these changes are in separate commits for the convenience of the
reviewer: I recommend starting at the first, and using n and p to
navigate them.
Individual
"au/units/*.hh"
files still pull in some decently heavy machinery. The sensible, scalable solution is to provide a"au/units/*_fwd.hh"
file corresponding to each of them. Each "regular" units header will include its_fwd.hh
header as the first include (and we add a comment to that effect to prevent clang-format from reordering them).Happily, this enables us to write a somewhat meaningful test for the forward declaraction machinery. We can now make a header file that provides an interface with only the forward declarations. Then we call that API inside of a test file.
Finally, this is worth updating the docs for:
fwd.hh
files.All of these changes are in separate commits for the convenience of the reviewer: I recommend starting at the first, and using
n
andp
to navigate them.Fixes #232.