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

Authoritatively forward declare core types #312

Closed chiphogg closed 3 weeks ago

chiphogg commented 4 weeks ago

From now on, anyone can just include "au/fwd.hh", and get authoritatively correct forward declarations. These will be implicitly tested automatically by adding an #include of this new file at the top of every file that has a definition for which we now provide a forward declaration: if we get a forward declaration wrong, we'll get a compiler warning.

We also include fwd.hh in a few places where it lets us get rid of some manual forward declarations.

The rep-named aliases move upstream into fwd.hh, because they'll be directly useful for forward declaration use cases, and because you can't "forward declare" an alias: you just have to move the definition upstream.

Helps #232. To resolve it completely, we will need to provide a forward declaration file for each individual unit file.