Commit graph

303 commits

Author SHA1 Message Date
Daniel Murphy
41a9f1fa05 Fix Issue 6408 - Phobos fixes
Do not use typeof(Type[0]) to get the element type of an array, use typeof(Type.init[0])
2013-01-18 19:10:16 +11:00
jmdavis
9bab8393c3 Made cycle's DollarToken private.
There's no reason for anyone to use it directly, so it's better for it
to be private.
2013-01-12 22:51:35 -08:00
Alex Rønne Petersen
c1c7adec0c Merge pull request #1065 from monarchdodra/repeatSlice
Provide slicing for Repeat
2013-01-12 08:50:29 -08:00
Alex Rønne Petersen
fa6131bb29 Merge pull request #1069 from monarchdodra/zipLockstep
Const fixes in Zip and Lockstep
2013-01-11 02:46:52 -08:00
jmdavis
1ec00a35d8 Add opSlice to Cycle. 2013-01-11 00:05:16 -08:00
unknown
24164c5e9b Various fixes in lockstep and zip
Mainly, they accepted the types R, provided Unqual!R is a range. But that doesn't make sense.

Reduced to only accepting if R itself is a range.

Improved constraints, fixed implementations, removed needles bug workaround.
2013-01-11 08:31:09 +01:00
unknown
af67984222 Activate bugfix 6336 unittest 2013-01-11 08:31:08 +01:00
monarch dodra
8298d0dfc3 Provide slicing for Repeat 2013-01-10 23:47:47 +01:00
monarch dodra
4fdaafa8a9 Remove back/popBack primitives from Repeat
Because a bidirectional infinite range makes no sense. AFAIK.
2013-01-10 13:31:47 +01:00
monarch dodra
273e5821ad use enum opDollar in Sequence
Because an enum is better than a function
2013-01-10 13:29:03 +01:00
monarch dodra
47ab0b3f92 Fix zip for slicing infinite ranges
Because the type returned is not the same.
2013-01-10 13:27:47 +01:00
Andrei Alexandrescu
ca44a116d5 Merge pull request #1047 from Poita/bug8367
Issue 8367 - Insufficient constraints for chain
2013-01-08 23:07:23 -08:00
Nick Treleaven
5083260795 Fix typos 2013-01-07 17:01:11 +00:00
Vladimir Panteleev
600862c927 Fix mismatched parens in DDoc. 2013-01-06 23:32:52 +02:00
Poita
3731c856c7 Undoing formatting error 2013-01-03 08:52:34 +00:00
Poita
8977fd6ae3 Changed only.Result to static struct 2013-01-03 08:45:46 +00:00
Peter Alexander
fb3a15a33f Voldemortification of std.range.only 2013-01-03 07:54:40 +00:00
Peter Alexander
483efc7d09 New docs, examples, added asserts for Only!T 2013-01-02 23:11:58 +00:00
Peter Alexander
7101a9c248 Using version(D_NoBoundsCheck) for Only!T 2013-01-02 05:20:38 +00:00
Peter Alexander
51c4f07756 Use RangeError + length optimisation for Only!T 2013-01-02 04:57:04 +00:00
Peter Alexander
1008da752b Issue 8367 - Insufficient constraints for chain
The error message from compiling the bug's sample code after this change is:

```
bug.d(11): Error: template std.range.chain does not match any function template declaration. Candidates are:
std/range.d(2018):        std.range.chain(Ranges...)(Ranges rs) if (Ranges.length > 0 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void))
bug.d(11): Error: template std.range.chain(Ranges...)(Ranges rs) if (Ranges.length > 0 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void)) cannot deduce template function from argument types !()(MapResult!(__lambda2, Foo[]),string)
```

Fixes Issue 8367
http://d.puremagic.com/issues/show_bug.cgi?id=8367
2013-01-01 21:17:06 +00:00
Peter Alexander
c8cf9197e6 Added std.range.only - range of a single element.
This adds range type `Only!T` and helper function `only!T(T)`. This is a range that iterates a single value, useful when some interface requires a range, but you only have a single value.
2013-01-01 20:51:19 +00:00
k-hara
2bbb33df2f Additional fix for issue 6905
For the inference of return value ref-ness, we should use 'auto ref' instead of 'ref' or 'const ref'
2012-12-24 17:48:17 +09:00
unknown
1c58c2d23c Gives sequence slice to end 2012-12-18 08:11:17 +01:00
Andrei Alexandrescu
af12683895 Merge pull request #854 from jmdavis/hasSlicing
Improvements to hasSlicing
2012-12-17 21:38:26 -08:00
k-hara
46b612de08 fix Issue 9060 - std.range.chain and std.range.zip cannot get frame pointer
Changes to avoid following two errors:
* "cannot access frame pointer"
* "field xxx must be initialized in constructor, because it is nested struct"
2012-12-18 09:22:24 +09:00
jmdavis
68db081f1e Removed incorrect @property attributes in std.range.
They were removed previously but reintroduced due to a bad rebase, so
I'm removing them again here.
2012-12-16 22:29:42 -08:00
jmdavis
a916ad8afb Strengthened isRandomAccess with regards to $.
It now requires that indexing with $ result in the same type as front if
r[$] works, and if that works, and the range isn't infinite, r[$ - 1]
must be the same type as front. Ideally, we'd require that r[$] work
regardless, but without enhancement #7177 being implemented, that would
likely break too much code, as opDollar was only recently fixed and
probably isn't used much.
2012-12-16 22:28:18 -08:00
jmdavis
6022082b29 Further strengthen hasSlicing.
The extra requirements are not currently enabled because of bug# 8847,
but they're now there, and they're listed as their in the documentation
so that no one will think that they're not supposed to apply.
2012-12-16 22:28:18 -08:00
jmdavis
a0b82a53b8 Add some requirements for opDollar to hasSlicing.
Ideally, opDollar would be outright required for any range with slicing,
but unless/until it's changed so that length automatically aliases to
opDollar when opDollar isn't defined (issue# 7177), that's probably not
a reasonable requirement to make.
2012-12-16 22:28:17 -08:00
jmdavis
0d9b31b594 Adustments to hasSlicing.
Now, it enforces that opSlice returns a range which can be assigned to
the original range type (so that it can be assigned to the original
range as long as the original range isn't const) as long as it's finite,
and it enforces that opSlice's result is the result of take when the
range is infinite.
2012-12-16 22:28:17 -08:00
jmdavis
24a696a2b2 Adjustments to take and takeExactly.
takeExactly now returns the same type as take where possible, and
neither take nor takeExactly check hasSlicing for infinite ranges (since
infinite ranges will soon be required to use them for slicing, and that
creates a circular dependency among those 3 templates
2012-12-16 22:28:16 -08:00
jmdavis
f8f2a81a60 Revert "Fix std.range.takeExactly trait to reject slices without length."
This reverts commit 6a0b6c4dee.
2012-12-16 22:28:15 -08:00
Andrei Alexandrescu
259cd23d67 Merge pull request #901 from Poita/bug8900
Fix bug 8900 - Zip with infinite char range fails.
2012-12-13 09:00:09 -08:00
jmdavis
74f8c844fe Revert "Add alias opDollar and use $ in range slicing"
This reverts commit 07104b5fe6.

As we cannot currenly rely on even ranges with slicing implementing
opDollar, this change breaks code, because it assumes that such ranges
implement opDollar.
2012-12-09 17:21:37 -08:00
Andrei Alexandrescu
7701b17fa7 Merge pull request #985 from jmdavis/range
Remove comments from range traits claiming that they don't require ranges
2012-12-08 20:51:15 -08:00
k-hara
07104b5fe6 Add alias opDollar and use $ in range slicing 2012-12-05 10:13:17 +09:00
k-hara
7ced8ac866 popFront and popBack are not properties 2012-12-03 00:53:54 +09:00
k-hara
2520cd0dc9 Should not mark member functions for operator overloading as properties. 2012-12-03 00:53:53 +09:00
k-hara
58a8ccf42e Fix for moveFront, moveBack, and moveAt
- I assume they are not properties, then changed to normal functions.
- Global .moveFront/Back uses front and back if member moveFront/back doesn't exist.
  Then, member aliases are just redundant.
2012-12-03 00:53:52 +09:00
jmdavis
be3e9d1bb3 Remove comments from range traits claiming that they don't require ranges.
I don't know why these were added or how they got past the reviewers,
but it makes no sense for traits which check ranges for various
attributes to say that they don't require a range - especially when they
specifically check stuff like front! The only two where such a comment
makes sense (hasLength and ElementType) already had such comments,
making the comments added to them redundant, whereas the others were
just plain wrong. This commit removes all of those incorrect comments.
2012-11-30 20:45:18 -08:00
unknown
783abf3fa6 Add popExactly/dropExactly/dropOne
Also:
* Consolidate the pairs "drop/dropBack" and "popFrontN/popBackN" into a single documented block
* Remove "dropFront" (useless alias)
2012-11-29 09:19:58 +01:00
Alex Rønne Petersen
1c22141596 Merge pull request #967 from 9rnsr/enforceProperty
For the more property enforcement
2012-11-22 22:29:20 -08:00
k-hara
01df2f60be Remove redundant parenthesis for getters, and use assignment syntax for setters 2012-11-23 15:07:17 +09:00
k-hara
2897ca8807 fix Issue 9062 - AddrExp should distinguish the existence of property resolution 2012-11-23 14:25:24 +09:00
Andrei Alexandrescu
5de964dea9 Merge pull request #941 from denis-sh/refactor-std.range.put
Refactor `std.range.put`
2012-11-18 20:56:53 -08:00
jmdavis
90e9bfee9d Quick fix to some ddoc comments so that they compile. 2012-11-16 22:24:06 -08:00
unknown
5f33a589e7 Insert dropBack, more examples of drop
Also fixes popBackN to only work on bidir.
Adds a logical path for popFrontN with infinite sliceable ranges.
2012-11-15 19:30:01 +01:00
Alex Rønne Petersen
5ed20fced6 Merge pull request #940 from denis-sh/reformat-std.range-book-table
Reformat `std.range` book table
2012-11-14 11:18:56 -08:00
Alex Rønne Petersen
c9c65fed95 Merge pull request #944 from denis-sh/fix-std.range-documentation
Fix `std.range` documentation
2012-11-14 11:17:26 -08:00