Most of the hana headers include also forward declaration headers contained in the subfolder fwd
, e.g. #include<boost/hana/fwd/pair.hpp
.
AFAIK forward declaration headers declare things instead of defining them, so the user can have a access limited to pointers (and references) to the functions and objects.
What sense does it make for boost::hana
, which is header-only templated library? The only thing that comes to my mind is that forward declarations are good enough if you do not intend to instantiate the declared templates, but then - what is the point of using them in the first place?
By looking at the library source I sense it is something very smart, which I still do not comprehend.
Imagine I need only very specific instances of the boost::hana
templates. Would it work, if I define and instantiate them in one translation unit, and link to them from all the other units, using forward declarations?