Commit graph

540 commits

Author SHA1 Message Date
torje
2b8c7dbe4c Correction of setIntersection's description in the cheat sheet.
setIntersection's description was the same as setDifference's, which 
seemed like an error, I think I fixed it.
2013-01-16 06:56:39 +00:00
monarch dodra
d9dd2b012e Fix minCount for ranges of immutables 2013-01-15 15:58:36 +01:00
Alex Rønne Petersen
2973b7ed2d Merge pull request #1048 from Poita/bug8368
Issue 8368 - Insufficient constraints for sort
2013-01-13 16:21:47 -08:00
Alex Rønne Petersen
bdc959933c Merge pull request #1070 from monarchdodra/9299
Fixes issue 9299 - std.algorithm.minPos of const(int)[]
2013-01-13 16:20:56 -08:00
unknown
5afbfac8c5 Fixes issue 9299 - std.algorithm.minPos of const(int)[] 2013-01-12 14:30:25 +01:00
Andrei Alexandrescu
6996f434af Merge pull request #1009 from monarchdodra/initializeAll
improvements to uninitializedFill && initializeAll
2013-01-11 07:55:04 -08:00
monarch dodra
7db6ba8cfd whitespace 2013-01-11 16:12:27 +01:00
Peter Alexander
b89adc0037 Added explanation of requirements in comments. 2013-01-10 21:04:51 +00:00
Alex Rønne Petersen
10d28218d8 Merge pull request #1058 from andralex/5726
Issue 5726 - boyerMooreFinder hangs when finding
2013-01-08 01:00:30 -08:00
Alex Rønne Petersen
85d2d2fc77 Merge pull request #1059 from andralex/5513
Issue 5513 - Erroneous example in std.algorithm
2013-01-08 01:00:06 -08:00
Andrei Alexandrescu
792392d30f Issue 5513 - Erroneous example in std.algorithm 2013-01-08 00:48:19 -08:00
Andrei Alexandrescu
2e2970aca2 Issue 5726 - boyerMooreFinder hangs when finding 2013-01-08 00:37:37 -08:00
jmdavis
c52a6558c2 Fix commonPrefix so that it can mix strings and other ranges.
The fix for 8890 made it so that commonPrefix could no longer compare
strings with ranges of other types. This fixes that.
2013-01-04 14:32:36 -08:00
jmdavis
545df62174 Slight tweak to commonPrefix's template constraint. 2013-01-04 14:32:36 -08:00
jmdavis
dd5eb5ff97 Fix for issue# 8890: commonPrefix does not handle unicode correctly.
It was returning partial code points if the first few code units in a
code point matched but not the entire code point.
2013-01-04 14:32:35 -08:00
monarch dodra
b39752d5c7 support for non RA with length in startWith
As suggested by Andrei.

Also: More unittests
2013-01-02 17:48:49 +01:00
Peter Alexander
ba86527c04 Fix 8368 - Insufficient constraints for sort
Error from bug code after this change:

```
Error: template std.algorithm.sort does not match any function template declaration. Candidates are:
std/algorithm.d(7820):        std.algorithm.sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range)(Range r) if ((ss == SwapStrategy.unstable && (hasSwappableElements!(Range) || hasAssignableElements!(Range)) || ss != SwapStrategy.unstable && hasAssignableElements!(Range)) && isRandomAccessRange!(Range) && hasSlicing!(Range) && hasLength!(Range))
bug.d(6): Error: template std.algorithm.sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range)(Range r) if ((ss == SwapStrategy.unstable && (hasSwappableElements!(Range) || hasAssignableElements!(Range)) || ss != SwapStrategy.unstable && hasAssignableElements!(Range)) && isRandomAccessRange!(Range) && hasSlicing!(Range) && hasLength!(Range)) cannot deduce template function from argument types !()(MapResult!(__lambda2, string[]))
```

Fixes Issue 8368
http://d.puremagic.com/issues/show_bug.cgi?id=8368
2013-01-01 21:47:57 +00:00
H. S. Teoh
7bd5c502e1 Oops, fix typo in ddoc. 2013-01-01 10:02:36 -08:00
H. S. Teoh
27cbd33627 Add non-trivial example for nextEvenPermutation. 2013-01-01 09:55:51 -08:00
H. S. Teoh
09674dd4ca Fix rollover bug in nextEvenPermutation. 2013-01-01 09:28:14 -08:00
H. S. Teoh
d13845de2c Add unittests for non-default sorting order. 2012-12-31 22:09:10 -08:00
H. S. Teoh
7c8834ad0e Improve documentation. 2012-12-31 22:09:10 -08:00
H. S. Teoh
380ee9b899 Improve ddocs for nextPermutation and nextEvenPermutation. 2012-12-31 22:09:09 -08:00
H. S. Teoh
ce18015ff2 Implement nextEvenPermutation. 2012-12-31 22:09:09 -08:00
H. S. Teoh
8ee30eff4e Implement nextPermutation for bidirectional ranges. 2012-12-31 22:09:09 -08:00
H. S. Teoh
d442a0322f Explain necessity of setItem being a mixin. 2012-12-31 07:27:23 -08:00
H. S. Teoh
4e329dc4b1 Add unittests for new joiner with separator.
Comment out assert which will segfault when passed a range of class
objects, because the .init value of a class object is null, and
.init.empty is a null dereference.
2012-12-30 21:19:04 -08:00
H. S. Teoh
10afee97c4 Make joiner (with separator) work with forward ranges and transient ranges.
This is for the variant of joiner that takes a separator.

Restructure algorithm to not call .popFront while we're still using
.front.

Make sure we .save subranges when we're exporting .save, since RoR.save
does not guarantee the state of subranges are also .save'd.
2012-12-30 21:19:04 -08:00
monarch dodra
abc9b2fea6 typo 2012-12-29 17:47:49 +01:00
monarch dodra
4a7811a9dc Fix previous bug in countUntil
as pointed out by denish-sh. Also, more unittests.
2012-12-29 17:10:15 +01:00
unknown
d00be2ff1a Optimization in startsWith(Range, Needles...)
Basically, makes it stop searching as soon as an element as matched.

This is an important optimization, that avoids a lot of startsWith's other "non-optimzations"...
2012-12-26 16:24:55 +01:00
unknown
cfcdfbb7db Optimizations in startsWith
* Consolidate implementation by checking length in a single spot.
* Checks narrow string or the same types' lengths.
* Index iterates on all RA ranges (and not just Arrays).

Ends with was left untouched, because it forwards to startsWith anyways.
2012-12-26 16:24:53 +01:00
unknown
a0f18336b0 Bit of unicode unittest in [starts|ends]With
Just sprinkling some tests. These covered a wee little bit of missing usecases.
2012-12-26 16:24:52 +01:00
unknown
1b4186b16e Clean up endsWith unittests
Original author wrote "wrap" because filter is not bidirectional. However, the function filterBidirectional fits the need, so migrating to that.
2012-12-26 16:24:52 +01:00
unknown
3270e9a4e1 "Ranges..." => "Needles..." in [starts|ends]With.
To avoid any confusion: The stuff in ranges may or may not actually be ranges. generic "Needles" is what best describes it.
2012-12-26 16:24:41 +01:00
Peter Alexander
14b7095bd8 Simplified std.algorithm.copy array overlap test.
The array overlap test in std.algorithm.copy did an unnecessary amount of comparisons. This pull request simplifies it.
2012-12-25 18:13:35 +00:00
Walter Bright
bbcd9a5d3c Merge branch 'master' of github.com:D-Programming-Language/phobos 2012-12-24 20:16:39 -08:00
Walter Bright
ef0bed7d15 fix memory corruption bug in unittest 2012-12-24 20:16:19 -08:00
Andrei Alexandrescu
58fde7057f Merge pull request #1024 from monarchdodra/countStarts
performance tweaks for countUntil
2012-12-24 09:44:02 -08:00
Andrei Alexandrescu
c1f8609e1f Merge pull request #1013 from Poita/endsWithRefactor
Refactored endsWith to use retro + startsWith.
2012-12-23 19:52:00 -08:00
unknown
f8782c37d9 performance tweaks for countUntil 2012-12-22 00:03:34 +01:00
H. S. Teoh
f687885a76 No need to use .save on inner range if we aren't going to export .save. 2012-12-20 10:20:30 -08:00
H. S. Teoh
7ff2fcec06 Fix issue 8061.
We cannot assume that RoR.save will also .save the state of its
subranges; so the only way we can correctly export a .save method in the
joined range is if we also .save its subranges as we traverse over them.
2012-12-20 10:03:43 -08:00
Andrei Alexandrescu
af12683895 Merge pull request #854 from jmdavis/hasSlicing
Improvements to hasSlicing
2012-12-17 21:38:26 -08:00
Walter Bright
3b683d99bf Merge pull request #1004 from 9rnsr/fix9060
Issue 9060 - std.range.chain and std.range.zip cannot get frame pointer
2012-12-17 21:02:38 -08:00
Alex Rønne Petersen
cc3176ab76 Merge pull request #1015 from monarchdodra/spaces
Removing trailing spaces in algorithm
2012-12-17 17:05:46 -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
unknown
027804bc28 Removing trailing spaces 2012-12-17 18:54:47 +01:00
jmdavis
57ddea7cf2 Fix to Map caused by changes to hasSlicing.
import std.algorithm;
import std.range;

void main()
{
    auto N2 = sequence!"n"(cast(size_t)1).map!"a";
}

ceased to compile, because Map's opSlice won't work anymore over
infinite ranges, because the result can't be reassigned to the original.
2012-12-16 22:28:17 -08:00
jmdavis
7d5d9fb1c0 Some whitespace cleanup. 2012-12-16 22:28:16 -08:00