Re: Arrays template arguments and CT data structures

2009-10-03 Thread BCS
Hello language_fan, You have probably already noticed that there is always a tradeoff to be made. Either you get smaller binaries and faster compilation times or larger binaries and (perhaps) more efficient runtime performance. Note that if the data structures are small, generating them takes

Arrays template arguments and CT data structures

2009-10-02 Thread bearophile
(after a small discussion on IRC) Tuples may be used for similar purposes, but fixed-sized arrays are simpler to use, simpler to define, and they don't induce compilation/code bloat. Is this a good idea? int foo(int[3] arr)() { return arr[1]; } const int[3] a = [10, 20, 30]; void main() {

Re: Arrays template arguments and CT data structures

2009-10-02 Thread language_fan
Fri, 02 Oct 2009 16:56:48 -0400, bearophile thusly wrote: A good purpose for compile-time functions is to pre-generate constant data structures, avoiding to waste time generating them at compile time. But currently creating fixed-sized arrays at compile time while possible is tricky (it's

Re: Arrays template arguments and CT data structures

2009-10-02 Thread Tom S
bearophile wrote: (after a small discussion on IRC) Tuples may be used for similar purposes, but fixed-sized arrays are simpler to use, simpler to define, and they don't induce compilation/code bloat. (...) What do you mean by that? So parametrizing a template with a static array would

Re: Arrays template arguments and CT data structures

2009-10-02 Thread bearophile
language_fan: Note that if the data structures are small, generating them takes very little time on modern 32/64-bit hardware. OTOH if you have tens of megabytes of binary data in your .exe, hard drives are a serious bottleneck. You forget an important thing: If you generate things at