
Mapping Types to Values (in C++) - nice_byte
http://gpfault.net/posts/mapping-types-to-values.txt.html
======
ambrop7
I only skimmed the article but it seems this requires "registration" for each
type and does not support template types.

What I would love to see it a completely generic type-to-value map ToValue<T>
for ANY T, possibly template types, and without any sort of registration
required. If the results are integers or otherwise ordered, they could then be
used for compile-time ordered data structures like RB trees or heaps, for the
implementation of some metaprogramming concepts.

Granted I believe that is impossible in plain C++.

~~~
nice_byte
No registration required: [http://cpp.sh/4zlbc](http://cpp.sh/4zlbc)

~~~
ambrop7
I was implying a compile-time solution, i.e. where the result of the mapping
is constexpr.

On second though, maybe it can be done at compile time, with this:
[http://b.atch.se/posts/constexpr-counter/](http://b.atch.se/posts/constexpr-
counter/)

