Commit graph

541 commits

Author SHA1 Message Date
jmdavis
7d5d9fb1c0 Some whitespace cleanup. 2012-12-16 22:28:16 -08:00
H. S. Teoh
3a2377ccd3 Replace joiner unittest with one that doesn't suffer from issue 9131. 2012-12-16 21:35:22 -08:00
H. S. Teoh
e471f8ee13 Completely get rid of UTF-8 to workaround OSX/64 bug. 2012-12-16 21:35:22 -08:00
H. S. Teoh
f83ad8a572 Add unittest for new joiner. 2012-12-16 21:35:22 -08:00
H. S. Teoh
d489281292 Rewrite joiner to not assume persistence of .front. 2012-12-16 21:35:22 -08:00
Peter Alexander
0c52706eb6 Refactored endsWith to use retro + startsWith.
What's the point of having all these powerful, generic, abstract functions if we're just going to copy and paste code? :-)

This change has several benefits:

* It is far more elegant.
* Changes (optimisations) to startsWith automatically carry across to endsWith.
* We get extra testing for startsWith and retro for free.
2012-12-17 02:08:39 +00:00
Hara Kenji
194ca07803 Merge pull request #1011 from blackwhale/fix-multisort
fix issue 9160 multiSort constraint regression
2012-12-16 17:34:09 -08:00
Peter Alexander
b7472c4e39 Corrected constraints for std.algorithm.endsWith
Previously endsWith constraints only required input ranges, but the algorithm uses `back` and `popBack` within, so clearly a bidirectional range is needed.
2012-12-15 23:20:20 +00:00
Dmitry Olshansky
bde7cbad4d fix issue 9160 multiSort constraint bug 2012-12-15 18:07:57 +04:00
Andrei Alexandrescu
1b2b5fb76e Merge pull request #951 from monarchdodra/count3
improvements/fixes for count countUntil
2012-12-13 09:17:47 -08:00
monarch dodra
e8d320f82f imporvements to uninitializedFill && initializeAll
Because they didn't really handle all of the cases correctly.

Added unittests.
2012-12-13 17:34:57 +01:00
Andrei Alexandrescu
0fcca44b8d Merge pull request #787 from blackwhale/loan-stable-sort
fix stable sort (4584)
2012-12-12 07:38:10 -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
lomereiter
9f8669b567 changed return type of NWayUnion.front to auto ref 2012-12-09 22:12:53 +04:00
k-hara
07104b5fe6 Add alias opDollar and use $ in range slicing 2012-12-05 10:13:17 +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
20341b4980 Implement issue# 9103.
find should work with multiple needles which are a combination of
elements and ranges rather than just all ranges - just like startsWith
and endsWith do - and since that overload of find calls startsWith, it's
trivial to make it take the same types of arguments as startsWith.
2012-12-02 01:53:29 -08:00
k-hara
0c88021d4b Add more test case 2012-11-25 17:23:33 +09:00
k-hara
a404b3108f Change module level functions to nested class static member. 2012-11-25 15:52:42 +09:00
k-hara
cd432f7b2f Add forward template 2012-11-25 13:47:00 +09:00
Dmitry Olshansky
3aa8e20371 extra test to make sure stable sort of non-lvalue ranges compiles & works 2012-11-23 23:52:01 +04:00
Dmitry Olshansky
dca2a007a2 whitespace & std.algortihm style unification 2012-11-23 23:18:12 +04:00
Dmitry Olshansky
585a9a241a add stable sort, tweaks to std.algorithm 2012-11-23 22:58:02 +04:00
k-hara
01df2f60be Remove redundant parenthesis for getters, and use assignment syntax for setters 2012-11-23 15:07:17 +09:00
monarch dodra
20d77cb8ff Changes to count[Until] as suggested by review 2012-11-22 20:35:24 +01:00
k-hara
28dedee456 Issue 7444 - Require [] for array copies too 2012-11-20 17:55:21 +09:00
monarch dodra
076c853b73 indexOf: More details
Not 100% about the text...
2012-11-20 09:05:52 +01:00
monarch dodra
0a3b7be8e1 Quick splitter countUntil fix
This is more of a band-aid..., splitter needs some deep fixing anyways...
2012-11-20 09:05:51 +01:00
monarch dodra
3dffa6c475 more improvements in cout/countUntil 2012-11-20 09:05:50 +01:00
unknown
1b7db2de5e improvements/fixes for count countUntil
Changes:

1. Count:
1.1 Better conditional statement
1.2 Count will now turn down any infinite haystacks (or else you'd count to infinity...)
1.3 Infinite needle will instantaneously return a count of 0.
1.4 Fixes a condition that was checking pred(haystack, needle), as opposed to pred(haystack.front, needle.front) (guess no one ever tried a fuzzy count?)
1.5 Fixes reference range support...*

2. countUntil:
2.1 Better conditional statement
2.2 countUntil supports InputRange for element and predicate search.
2.3 Fixes unicode bug (return the amount of popFronts, not index)
2.4 Fixes http://d.puremagic.com/issues/show_bug.cgi?id=8804
2.5 Fixes http://d.puremagic.com/issues/show_bug.cgi?id=8821

Note: count is still subject to the bugs in splitAfter
* Incorrect reference range support
* Incorrect split for forward range
Both are corrected in another pull.
As such, no unittests are added (yet).
2012-11-17 09:46:17 +01:00
Andrei Alexandrescu
6e9cf770d8 Merge pull request #879 from monarchdodra/walkSave
saving before calling walkLength
2012-10-25 06:25:56 -07:00
Andrei Alexandrescu
d05996c015 Merge pull request #849 from monarchdodra/fillv2
Fix for fill(value) (again)
2012-10-22 13:56:05 -07:00
Vladimir Panteleev
fde0998dea Fix various problems in DDoc, identified from compiler warnings. 2012-10-19 19:09:47 +03:00
H. S. Teoh
f9182ecaab Fix isInfinite conditions.
It makes little sense to join a range of infinite subranges, as we'll
never get beyond the first range, and besides, the outer range might be
empty so setting empty=false is wrong. OTOH, it's valid to have an
infinite range of subranges, in which case the output will be infinite.
So that should be the case that's checked for here.
2012-10-17 08:19:50 -07:00
monarch dodra
b1071559f7 saving before calling walkLength 2012-10-17 16:28:24 +03:00
Alex Rønne Petersen
56ab2c3492 Merge pull request #876 from Poita/mapdoc
std.algorithm.map does not cache front. Update ddoc.
2012-10-16 16:00:55 -07:00
Peter Alexander
d8258dfcbb Map does not cache. Update ddoc. 2012-10-16 17:51:35 +01:00
jmdavis
4d591a858f Improvement to std.algorithm.sort's documentation.
Apparently, the situation with sort's return value is not currently
clear enough.
2012-10-15 22:19:01 -07:00
Alex Rønne Petersen
02c3e1d25c Merge pull request #869 from Poita/splitter-sliceable
splitter ddoc and constraint improvements.
2012-10-15 15:15:02 -07:00
Peter Alexander
f5bdd5730c Added mention of narrow string types to splitter ddoc. 2012-10-15 19:03:50 +01:00
Andrei Alexandrescu
0db13f5966 Merge pull request #859 from alexrp/sizediff_t-to-ssize_t
Remove all uses of sizediff_t in favor of ptrdiff_t.
2012-10-14 19:26:59 -07:00
alexrp
b202180295 Remove all uses of sizediff_t in favor of ptrdiff_t. 2012-10-15 04:24:09 +02:00
Peter Alexander
035eddda46 splitter ddoc and constraint improvements.
splitter requires a sliceable range, contradicting
the ddoc. Additionally, one of the overloads
requires a sliceable range, but omits this from
the if-constraint.

This commit mentions the sliceable constraint in
the ddoc and tightens the constraints of the
overload to require slicing.
2012-10-14 23:58:53 +01:00
jmdavis
5a0c67f085 Expanded test for issue# 8792. 2012-10-13 18:31:47 -07:00
H. S. Teoh
dd58276c00 Coding style. 2012-10-13 14:38:04 -07:00
H. S. Teoh
01a690654a Add unittest for issue 7992. 2012-10-13 14:38:04 -07:00
H. S. Teoh
fc1d661f4b Fix wrong haystack emptiness check in simpleMindedFind. 2012-10-13 14:38:04 -07:00
H. S. Teoh
d215dabbe2 Add unittest for issue 8792. 2012-10-09 22:03:48 -07:00
H. S. Teoh
0c4ebc2ce7 Fix issue 8792.
std.algorithm.joiner(ror).Result.save fails to copy over _valid_current,
resulting in a defective copy returned by .save.
2012-10-09 21:58:19 -07:00
monarch dodra
6541e23b02 Fix for fill(value) 2012-10-07 17:25:11 +03:00