Re: normal function and template function conflict

2012-07-26 Thread Jonathan M Davis
On Thursday, July 26, 2012 21:49:35 Andrej Mitrovic wrote: > On 7/26/12, Jacob Carlborg wrote: > > void seed () (UIntType value = default_seed) > > > > Less typing as well. > > Yep. It's funny how this works at all. I mean a template with no > template parameters is somehow still a template. :)

Re: normal function and template function conflict

2012-07-26 Thread Andrej Mitrovic
On 7/26/12, Jacob Carlborg wrote: > void seed () (UIntType value = default_seed) > > Less typing as well. Yep. It's funny how this works at all. I mean a template with no template parameters is somehow still a template. :)

Re: normal function and template function conflict

2012-07-26 Thread Jacob Carlborg
On 2012-07-26 19:57, Simen Kjaeraas wrote: 2) Is there a "correct" workaround? Exactly what you did. Though, for brevity, you would write this: void seed(T : UIntType)(T value = default_seed) Since a template function is actually not wanted this would be the correct workaround: void seed

Re: normal function and template function conflict

2012-07-26 Thread monarch_dodra
On Thursday, 26 July 2012 at 18:21:18 UTC, Ali Çehreli wrote: Search for "specialization" in the following resources: Oh... "Specialization". What with D's ability to conditionally implement, I had completely forgotten about specialization. So that's how it's done in D. Cool. Thanks a lot.

Re: normal function and template function conflict

2012-07-26 Thread Simen Kjaeraas
On Thu, 26 Jul 2012 20:14:10 +0200, monarch_dodra wrote: On Thursday, 26 July 2012 at 17:57:31 UTC, Simen Kjaeraas wrote: On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra wrote: 2) Is there a "correct" workaround? Exactly what you did. Though, for brevity, you would write this: void s

Re: normal function and template function conflict

2012-07-26 Thread Ali Çehreli
On 07/26/2012 11:14 AM, monarch_dodra wrote: On Thursday, 26 July 2012 at 17:57:31 UTC, Simen Kjaeraas wrote: On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra wrote: 2) Is there a "correct" workaround? Exactly what you did. Though, for brevity, you would write this: void seed(T : UIntType)

Re: normal function and template function conflict

2012-07-26 Thread monarch_dodra
On Thursday, 26 July 2012 at 17:57:31 UTC, Simen Kjaeraas wrote: On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra wrote: 2) Is there a "correct" workaround? Exactly what you did. Though, for brevity, you would write this: void seed(T : UIntType)(T value = default_seed) Thanks I haven't s

Re: normal function and template function conflict

2012-07-26 Thread Simen Kjaeraas
On Thu, 26 Jul 2012 19:18:21 +0200, monarch_dodra wrote: So here are my two questions: 1) Is what I was originally trying to do actually illegal, or is it some sort of compiler limitation? TDPL implies this should work perfectly fine... Compiler limitation. It's supposed to work. 2)

normal function and template function conflict

2012-07-26 Thread monarch_dodra
I was trying to write a PRNG, and I wanted to give it two seed methods. The first is to seed from a unique UIntType, and the other is to seed from an entire range of seeds. Like so: void seed(UIntType value = default_seed) {...} void seed(Range)(Range range) if (isInputRange!Range)