Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
On 1/4/11 2:48 AM, %u wrote:
Hi,
I just wanted to say, it's funny how I did the *EXACT* same thing only
**a few
days ago**:
http://stackoverflow.com/questions/245584/d-templates-coolest-hack/4437847#4437847
Not counting the braces, the actual code is just 4 lines for the
compile-time
version, and 5 lines for the run-time version. The page above only has
a link to
one of these; both of the versions are here:
http://ideone.com/q8lvf
Pretty short, eh? I doubt that it can get any shorter than that code.
:) Feel free
to use my version inside the library. ("I hereby release the code to
the public
domain," to cover the legal stuff.)
Just posted a response to that thread, too. Somehow all that thread
should spill into reddit :o).
I took the liberty of spilling it:
http://www.reddit.com/r/programming/comments/ew0c7/coolest_template_metaprogramming_tricks_in_d/
--
Simen