|
Boost : |
Subject: Re: [boost] Attn metaprogrammers! [Better Enums] More complete release - feedback requested
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-06-08 21:04:17
On 9/06/2015 03:01, Anton Bachin wrote:
> Thatâs right, for now I am simply doing a linear scan through an array of
> strings. Changing the complexity to sub-linear is on my list of things to do,
> and Iâve considered those approaches (compile-time binary search, hashing, and
> trie). So far, Iâve been focusing on the interface and generation procedure
> instead, so I didnât want to get into too much optimization before I knew
> exactly what the constraints would be. Itâs getting pretty stable now, so I
> would be grateful for any comments/assistance with compile-time data structures.
Don't forget to measure performance. Given that enums tend to have a
very low N, when I made a superficially similar static map with a
runtime string index scan it turned out to be faster to just do the
linear scan than to try to compute hashes or do more complex searches.
(As an aside, it was quite a handy data structure. It was mainly
intended for string-to-enum conversions but because of the way it was
templated it could be abused to do string-to-member-pointer conversions
as well, which enabled all sorts of interesting reflection scenarios.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk