
On 12/6/24 16:47, Peter Dimov via Boost wrote:
Andrey Semashev wrote:
I also had compile-time dependencies in mind when I said "lightweight". To take the example from the docs:
https://pdimov.github.io/hash2/doc/html/hash2.html#hashing_objects_user_defi...
class X { private: std::string a; int b;
// ... public: template
friend void tag_invoke( boost::hash2::hash_append_tag const&, Hash& h, Flavor const& f, X const& v ) { boost::hash2::hash_append(h, f, v.a); boost::hash2::hash_append(h, f, v.b); } }; This requires one to depend on Boost.Hash2 for hash_append_tag and hash_append. I would prefer if there was a way (properly documented and supported) to avoid this dependency entirely.
Once things stabilize, you will be allowed to copy hash_append_fwd.hpp locally (or just declare the functions yourself.)
This has always been the intent, but GCC bugs and BOOST_CXX14_CONSTEXPR complicated matters.
As I mentioned, we briefly considered requiring C++14 so that the latter isn't an issue, but the feedback on Slack was negative. People love C++11 for some reason or other. Either way, this still wouldn't have solved the GCC issue.
https://github.com/pdimov/hash2/blob/develop/include/boost/hash2/hash_append...
Forward declarations are kind of fragile and they limit future evolution of the library. And they are tedious to add, considering that they would be needed everywhere where hashing support is needed. I would rather prefer the approach that doesn't need forward declarations.