|
Boost : |
From: Julien Blanc (julien.blanc_at_[hidden])
Date: 2022-06-24 16:40:44
Le vendredi 24 juin 2022 Ã 12:46 +0000, Hadriel Kaplan via Boost a
écrit :
> By the way Julien, I was going to suggest something eventually that
> might be⦠controversial, but since Richard brought them up Iâll
> mention it now:
>
> I think this thing should automatically handle more than just
> Boost.Describe. I think it should try to handle magic_enum and
> wise_enumâs generated-enum-info too.
>
> That would make it usable by a much broader user base.
That should not be too hard to do, but could require some additions in
these libraries. Basically, what is needed is a way to transform the
enumeration values list into a corresponding integer list, which then
gets feeded to the default_indexer â and of course a way to do compile-
time detection of the fact that the enum has some introspection (like
has_describe_enumerators). At that point, all the machinery is already
in place. For example, describe integration is only 25 lines of code.
Out of the box this should already work for wise-enum:
indexed_array<X,Â
interval<wise_enum::enumerators<MyEnum>::range.front(),
wise_enum::enumerators<MyEnum>::range.back()>>
But there is no contiguity check, and it would be much simpler to write
just indexed_array<X, MyEnum>.
> If thatâs technically challenging to do, then I think you should
> approach the authors of them and ask to ânormalizeâ whatever needs to
> be the same, to make them all usable with this.
>
> I donât know how theyâd respond, but it would be really cool if
> people could start writing things like index_array that supports all
> of them.
That would indeed be a nice addition. I'll try to see what can be done
here.
Best regards,
Julien
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk