brunocodutra / metal

Love template metaprogramming
https://brunocodutra.github.io/metal/
MIT License
324 stars 23 forks source link

Headers under metal/ are not installed #122

Open cpreh opened 4 years ago

cpreh commented 4 years ago

CMake's install target only installs metal.hpp and nothing else. The documentation uses the more specific headers everywhere (i.e. #include <metal/list/accumulate.hpp> to use metal::accumulate) which suggested to me that using these is also supported.

brunocodutra commented 4 years ago

The recommended way of consuming Metal is through the single header generated by cmake. One can still use specific headers if so desired, but the include tree cannot be automatically installed by cmake, since this would lead to ambiguities as the same code would be present on two separate files.

Docs refer to the specific headers as a way of linking back to the source code so the user can easily find the implementation, but I do see how this can be confusing as it suggests one should be including those headers.

I'm not sure how to solve this conundrum though, any suggestions @freundlich?

cpreh commented 4 years ago

So as it is right now, if I want to use an installed version of metal, I basically have to use the single header metal.hpp. The only way to allow both include styles would be to install both: the single header file and the include tree, which would lead to code duplication as you mentioned. I'm not sure it's worth it. What we should definitely do, however, is to clarify this in the documentation. Maybe it might be an idea to make it explicit that you should include metal.hpp for everything. e.g. write something like metal::accumulate: #include , implemented in <metal/list/accumulate.hpp>. This way you can still find the implementation in the source code, but you shouldn't accidentally include the wrong header.

brunocodutra commented 4 years ago

What we should definitely do, however, is to clarify this in the documentation.

Absolutely, thanks for reporting.