Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2021-03-03 15:33:41


Dominique Devienne wrote:
> By coincidence I was reading Folly's Poly [1] yesterday, where Eric uses
> folly::sig to support overloading. Not sure it's relevant though :)
>
> Which brings up the question of support in Describe of non-member
> functions, also mentioned on that page. Can they be incorporated into the
> described members?
> Just curious.

I wouldn't want to do that; the nonmembers are part of the enclosing
namespace, and would properly be reflected as such one day when we have
real language reflection. It's true that Describe, being a library, is more flexible,
but I'd like to keep it as close as possible to the eventual real thing.

> On another topic, could you have an example using std::variant?

There's nothing particularly unique about std::variant; it's like any other
standard container class such as std::vector. If the serialization library you're
using supports std::variant, it will integrate with Describe.

Here for instance is an example of generating a hash function for described
classes using ContainerHash:

https://gist.github.com/pdimov/caef1e0c42f9ceaf37eef529d78e2081

Since Boost.ContainerHash supports std::variant out of the box, everything
just works.


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