On 13/01/12 10:48 PM, DNewbie wrote:
I can't understand it. Why would someone need template programming. What
problem does template solve?
Well read on and see :-)
Peter:
Suppose you want to write a function to get the minimum of two integers.
It's easy:
Oh.. I see.
Thank you
On Sat, Jan 14, 2012 at 01:08, Ali Çehreli acehr...@yahoo.com wrote:
Here is another resource that tries to answer that question:
http://ddili.org/ders/d.en/templates.html
Parts of the source code may be left to the compiler to be filled in until
that part is actually used in the program.
On 01/14/2012 12:11 AM, Philippe Sigaud wrote:
On Sat, Jan 14, 2012 at 01:08, Ali Çehreliacehr...@yahoo.com wrote:
http://ddili.org/ders/d.en/templates.html
Hi Ali, I discovered you had a chapter on templates just a few days
ago.
That chapter is intentionally incomplete. I think
On Sat, Jan 14, 2012 at 15:56, Ali Çehreli acehr...@yahoo.com wrote:
On 01/14/2012 12:11 AM, Philippe Sigaud wrote:
On Sat, Jan 14, 2012 at 01:08, Ali Çehreliacehr...@yahoo.com wrote:
http://ddili.org/ders/d.en/templates.html
Hi Ali, I discovered you had a chapter on templates just a few
On Sat, Jan 14, 2012, at 09:07 AM, Philippe Sigaud wrote:
On 13/01/12 10:48 PM, DNewbie wrote:
I can't understand it. Why would someone need template programming. What
problem does template solve?
Well read on and see :-)
Peter:
Suppose you want to write a function to get the
On Wed, Jan 11, 2012, at 01:16 PM, Mike Parker wrote:
On 1/10/2012 10:57 PM, DNewbie wrote:
On Tue, Jan 10, 2012, at 10:37 PM, Mike Parker wrote:
Those samples use a binding to the Win32 API[1] that does not ship with
DMD. So in your case, std.c.windows.windows is probably what you want
Hi,
Is there a reason why I cannot compile the following code:
module test;
struct Test {
int delegate(int) f;
}
Test s = Test((int x) { return x + 1; });
void main(string[] args) {
return;
}
dmd 2.057 says:
test.d(7): Error: non-constant expression cast(int delegate(int))delegate
Good work Philippe, looks good!
I've never noticed std.conv.parse takes a radix argument, silly me.
And will take
a look at readf from std.stream, definitely.
Thanks!
On 14 January 2012 01:20, Justin Whear jus...@economicmodeling.com wrote:
On Fri, 13 Jan 2012 23:05:19 +0100, Matej Nanut wrote:
While we're at it: what's the
I guess these are CTFE (compile-time function evaluation) issues,
someone else might know more. A workaround is to use a module
constructor which will run before main():
struct Test {
int delegate(int) f;
}
Test s;
static this() {
s = Test((int x) { return x + 1; });
}
Note that 's' is
A rectangular array is really just one array, is it not? From a syntax
point it looks like a multidimensional array but really it's just a
single linear piece of memory, so just cast it:
void main()
{
int[2][4] table;
table[0][] = 0;
table[1][] = 1;
table[2][] = 2;
table[3][]
I guess join() could be specialized for static arrays and then just do
a dup and a cast? Would that work ok?
On Fri, Jan 13, 2012 at 09:30:35PM -0800, Jonathan M Davis wrote:
On Friday, January 13, 2012 18:47:19 H. S. Teoh wrote:
[...]
But what I really want to accomplish is to parse a string containing
multiple words; at each point I have a list of permitted words that
need to be matched against
On Saturday, January 14, 2012 19:13:02 H. S. Teoh wrote:
On Fri, Jan 13, 2012 at 09:30:35PM -0800, Jonathan M Davis wrote:
On Friday, January 13, 2012 18:47:19 H. S. Teoh wrote:
[...]
But what I really want to accomplish is to parse a string containing
multiple words; at each point I
On Saturday, January 14, 2012 19:45:55 Jonathan M Davis wrote:
If you have to worry about punctuation, then == isn't going to work. You'll
need to use some other combination of functions to strip the punctuation
from one or both ends of the word. One possible solution would be something
like
15 matches
Mail list logo