On Friday, 4 September 2015 at 15:52:08 UTC, Enamex wrote:
The biggest problem, I think, is that a template can has
multiple 'predicates' to agree to be instantiated, but only
some of them can mutually exclusive (the specialization syntax
produces mutually exclusive ones, the if-constraints
On Monday, 17 August 2015 at 13:18:43 UTC, Steven Schveighoffer
wrote:
I was just looking at fixing this
bug:https://issues.dlang.org/show_bug.cgi?id=14925
[...]
How often are you writing overloaded templates, and you want to
say "if it doesn't match anything else, do this"? I'd love to
see
On 8/17/15 6:44 PM, anonymous wrote:
On Monday, 17 August 2015 at 22:32:10 UTC, Idan Arye wrote:
On Monday, 17 August 2015 at 21:27:47 UTC, Meta wrote:
[...]
At that point, couldn't you just use static if inside the body of the
template instead of using template constraints?
No. Consider
On Monday, 17 August 2015 at 21:27:47 UTC, Meta wrote:
On Monday, 17 August 2015 at 17:17:15 UTC, Steven Schveighoffer
wrote:
On 8/17/15 1:00 PM, Idan Arye wrote:
It looks a bit ugly, that the `else` is after a function
declaration
instead of directly after the if's then clause. How about
On Monday, 17 August 2015 at 22:32:10 UTC, Idan Arye wrote:
On Monday, 17 August 2015 at 21:27:47 UTC, Meta wrote:
[...]
At that point, couldn't you just use static if inside the body
of the template instead of using template constraints?
No. Consider this:
On Monday, 17 August 2015 at 22:44:15 UTC, anonymous wrote:
On Monday, 17 August 2015 at 22:32:10 UTC, Idan Arye wrote:
On Monday, 17 August 2015 at 21:27:47 UTC, Meta wrote:
[...]
At that point, couldn't you just use static if inside the
body of the template instead of using template
On 8/17/15 9:18 AM, Steven Schveighoffer wrote:
The issue (as I noted in the bug report), is that the array being
replaced is some string, and the element type of the stuff to replace
is a dchar. But the first version is better for replacing a char[] in a
char[], and works just fine.
I guess
I was just looking at fixing this
bug:https://issues.dlang.org/show_bug.cgi?id=14925
A little background for the root cause:
replaceInPlace has 2 versions. One is a specialized version that
replaces the actual elements in an array with another array of the same
type.
The second version
On 08/17/2015 03:18 PM, Steven Schveighoffer wrote:
Can we do something like this? I'm not a compiler guru, so I defer to
you experts out there.
Implementation is trivial. (A naive implementation strategy which works
is to just use the obvious lowering.)
On Monday, 17 August 2015 at 13:18:43 UTC, Steven Schveighoffer
wrote:
void replaceInPlace(T, Range)(ref T[] array, size_t from,
size_t to, Range stuff)
if(isDynamicArray!Range
is(Unqual!(ElementEncodingType!Range) == T)
!is(T == const T)
!is(T == immutable T))
{ /* version 1
On Monday, 17 August 2015 at 16:57:33 UTC, Zoadian wrote:
wouldn't is(typeof(replace(array, from, to, stuff))) better be
a static if inside the first version?
nevermind, I missed that the first constraint is negated.
In that case I agree, else if would be nice.
On Monday, 17 August 2015 at 13:18:43 UTC, Steven Schveighoffer
wrote:
void replaceInPlace(T, Range)(ref T[] array, size_t from,
size_t to, Range stuff)
if(isDynamicArray!Range
is(Unqual!(ElementEncodingType!Range) == T)
!is(T == const T)
!is(T == immutable T))
{ /* version 1
On 8/17/15 1:00 PM, Idan Arye wrote:
It looks a bit ugly, that the `else` is after a function declaration
instead of directly after the if's then clause. How about doing it
with the full template style?
template replaceInPlace(T, Range)
if(isDynamicArray!Range
On Monday, 17 August 2015 at 17:17:15 UTC, Steven Schveighoffer
wrote:
On 8/17/15 1:00 PM, Idan Arye wrote:
It looks a bit ugly, that the `else` is after a function
declaration
instead of directly after the if's then clause. How about
doing it
with the full template style?
template
14 matches
Mail list logo