On Monday, 5 December 2016 at 21:51:28 UTC, pineapple wrote:
On Sunday, 4 December 2016 at 11:18:56 UTC, rumbu wrote:
---
If you really wanted an `isInputRange` that behaves like you're
wanting, it's only a 6 line template that you would have to
interject in your code.
enum bool
On Monday, 5 December 2016 at 21:51:28 UTC, pineapple wrote:
https://github.com/pineapplemachine/mach.d
I love that a few of the subfolders have a Readme.md so that I
don't have to dig in to anything to get an overview.
On Sunday, 4 December 2016 at 11:18:56 UTC, rumbu wrote:
Yes, this is the same workaround I found, but that does not
solve the fact that the following code does not compile:
While it may be too late to redeem Phobos and its handling of
arrays as ranges, it is worth noting that in the library
On Sunday, December 04, 2016 13:37:35 rumbu via Digitalmars-d wrote:
> I think that the array range UFCSs must be moved out from the
> std.range.primitives and let the library user to decide if there
> is a need for range semantics applied to all arrays.
That's not happening. In fact, pretty much
On Sunday, 4 December 2016 at 13:37:35 UTC, rumbu wrote:
There is nowhere in the documentation where arrays are
advertised as ranges by default.
Huh. It really doesn't seem to say so in the prose. It's shown in
the examples for isInputRange, though:
static assert(
On Sunday, 4 December 2016 at 11:50:08 UTC, Mike Parker wrote:
On Sunday, 4 December 2016 at 11:18:56 UTC, rumbu wrote:
Of course, the previous code will compile if we change the
imports:
import std.range.primitives: isInputRange, front, popFront,
empty;
But that just prove the bad
On Sunday, 4 December 2016 at 11:18:56 UTC, rumbu wrote:
Of course, the previous code will compile if we change the
imports:
import std.range.primitives: isInputRange, front, popFront,
empty;
But that just prove the bad design of isInputRange which cannot
be used all alone without the
On Sunday, 4 December 2016 at 05:31:59 UTC, lobo wrote:
This works for me when specialising for input ranges, strings
and arrays.
auto f(T)(T val)
if(isInputRange!T && !isSomeString!T && !isArray!T) {}
auto f(T)(T val)
if(isSomeString!T) {}
auto f(T)(T val)
if(isArray!T &&
On Saturday, 3 December 2016 at 17:29:47 UTC, rumbu wrote:
On Saturday, 3 December 2016 at 16:37:21 UTC, Jerry wrote:
On Saturday, 3 December 2016 at 11:52:00 UTC, rumbu wrote:
[...]
[...]
[...]
Is that the exact code? isInputRange checks to see if the type
has "front" defined.
On Saturday, 3 December 2016 at 16:37:21 UTC, Jerry wrote:
Also "string" is just an alias of an array,
"immutable(char)[]". So an array should have "front" defined.
Can you post more code?
You still have to `import std.range.primitives : front`, even for
arrays.
On Saturday, 3 December 2016 at 16:37:21 UTC, Jerry wrote:
On Saturday, 3 December 2016 at 11:52:00 UTC, rumbu wrote:
import std.range.primitives: isInputRange;
void test(R)(ref R range) if (isInputRange!R)
{
auto c = r.front; //Error: no property 'front' for type
'string'
}
[...]
On Saturday, 3 December 2016 at 11:52:00 UTC, rumbu wrote:
import std.range.primitives: isInputRange;
void test(R)(ref R range) if (isInputRange!R)
{
auto c = r.front; //Error: no property 'front' for type
'string'
}
string s = "some string";
test(s);
The problem is that isInputRange
import std.range.primitives: isInputRange;
void test(R)(ref R range) if (isInputRange!R)
{
auto c = r.front; //Error: no property 'front' for type
'string'
}
string s = "some string";
test(s);
The problem is that isInputRange will always return true for
string types (because it will
13 matches
Mail list logo