Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-06 13:47:18


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_defined_types
>
> class X
> {
> private:
> std::string a;
> int b;
>
> // ...
> public:
> template<class Hash, class Flavor>
> 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_fwd.hpp


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk