aurora-opensource / au

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

Closed chiphogg closed 3 weeks ago

chiphogg commented 3 weeks ago

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:

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.

Fixes #232.