
Efficient parameter pack indexing in C++ - ingve
http://ldionne.com/2015/11/29/efficient-parameter-pack-indexing/
======
comex
The C++ template system is quite possibly the worst functional programming
language ever 'designed', with the exception of esolangs. It would be so much
saner if we could just run normal C++ code at compile time, with the ability
to manipulate the main program's types as values. Then operations like this
would simply be indexing a `std::vector<Type>`, there would be no need to add
hacky special cases to the compiler and/or massively increase compilation
time, and it would be possible to do somewhat more complex things without
going insane (e.g. a compile-time perfect hash table generator, like gperf but
without needing an external tool).

Rust has something like this in the form of procedural macros, but it can't
manipulate types and values, only raw ASTs. Apparently Nim can do it.

~~~
srean
Your first paragraph actually describes D. In the D world the compile time
language and the runtime language is the same thing. You can take a look to
see if you like it.

------
opk
Would be nice if the article explained what it means by a "parameter pack" to
begin with.

~~~
comex
It's the variadic part of a C++11 variadic template:

[http://en.cppreference.com/w/cpp/language/parameter_pack](http://en.cppreference.com/w/cpp/language/parameter_pack)

------
coherentpony
The results are completely garbled for me.

Edit: Using an ancient version of Chrome on linux.

~~~
wrsh07
Same -- but I have js disabled. So that might be why.

~~~
copperx
Off topic -- but how do you navigate the modern Web without js?

