Commit graph

233 commits

Author SHA1 Message Date
Sebastian Wilzbach
f3a840144a Merge pull request #4921 from RazvanN7/Issue_8573
Issue 8573 - A simpler Phobos function that returns the index of the …
2016-12-16 16:16:48 +01:00
RazvanN7
d2c7d3761b Issue 8573 - A simpler Phobos function that returns the index of the mix or max item
Issue 8573 - A simpler Phobos function that returns the index of the mix or max item

added some review fixes

fixed an issue with a mutable variable

Applied review feedback

Renamed functions to minIndex and maxIndex + used sizediff_t for return value type

Updated function so that it works optimally even for lazy ranges and algorithms

Reverted to having only copyable elements in ranges

Added more unittests; implemented an array path; fixed documentation

Squashed commits
2016-12-16 11:11:07 +02:00
Sebastian Wilzbach
cc7f125ed1 Add missing imports to public unittests 2016-12-15 23:23:35 +01:00
Sebastian Wilzbach
f0c5a9fad6 Follow-up style fixes for December 2016-12-08 12:32:24 +01:00
RazvanN7
ff4b6b9e65 Solved a minor bug 2016-12-06 16:01:21 +02:00
RazvanN7
2e896520c9 Applied review feedback, fixed some bugs + added unit tests for them 2016-12-06 13:52:24 +02:00
RazvanN7
60396a1d67 Fixed some issues 2016-12-06 13:19:57 +02:00
RazvanN7
71ffa25d8a added a comment 2016-12-06 13:19:57 +02:00
RazvanN7
e4b82503b8 Issue 8829 - std.algorithm.find fails to take advantage of SortedRange 2016-12-06 13:19:57 +02:00
RazvanN7
752b2ca210 Issue 8829 - std.algorithm.find fails to take advantage of SortedRange 2016-12-06 13:19:57 +02:00
RazvanN7
d6519853e1 Issue 8829 - std.algorithm.find fails to take advantage of SortedRange 2016-12-06 13:19:57 +02:00
RazvanN7
8b29f206ae Issue 8829 - std.algorithm.find fails to take advantage of SortedRange 2016-12-06 13:19:57 +02:00
Alexandru Razvan Caciulescu
946a46774c Fix Issue 8087 - Improve clarity of std.algorithm documentation 2016-10-31 08:17:06 +02:00
Nick Treleaven
ae6a8031cf Add findSplitBefore example with an element using only()
Also remove typo.
2016-10-06 12:05:03 +01:00
e-y-e
befa0bfb6e Updated Flag uses to Yes/No structs 2016-09-29 14:45:20 +01:00
e-y-e
ad2563f8e7 Change yes/no enum OpenRight to a Flag 2016-09-23 10:08:46 +01:00
Walter Bright
9cfe39bfe2 searching.d: add scope annotations 2016-09-06 02:33:12 -07:00
Jack Stouffer
268fa2538d Add some const and immutable to std.algorithm 2016-07-01 17:11:09 -04:00
Andrei Alexandrescu
e59c06b410 Merge pull request #4431 from wilzbach/document_std_algorithm_test
add external imports to documented unittests in std.algorithm
2016-06-18 06:38:44 -04:00
Andrei Alexandrescu
ac9c93cb9e Merge pull request #4315 from wilzbach/algorithms_private_cleanup
std.algorithm: set accidentally exposed methods to private
2016-06-18 04:27:58 -04:00
Sebastian Wilzbach
ec47ac4224 Remove the WEB macro in favor of HTTP
replacement: sed 's/\$(WEB/\$(HTTP/g' -i **/*.d
2016-06-16 00:14:51 +02:00
Sebastian Wilzbach
8b60ec24b0 add external imports to documented unittests in std.algorithm 2016-06-15 03:42:28 +02:00
Sebastian Wilzbach
823203fc4f fix slipped through style violations 2016-06-05 01:30:55 +02:00
Sebastian Wilzbach
0c100a7b5a std.algorithm: set accidentally exposed methods to private 2016-06-04 16:13:07 +02:00
Andreas Zwinkau
9d77777941 Removed outdated comment
Slipped through pull request #4362. Since "above" is a different
algorithm the removed comment is misleading. It did make sense in
previous versions of PR #4362.
2016-06-02 22:59:40 +02:00
Andreas Zwinkau
a9d5b8ca77 Improve speed of find for random access needles (strings)
For find a string within a string, std.algorithm.searching.find was
unnecessarily slow. The reason is it created intermediate slices. A
naively written nested-for-loop implementation was a few times
faster.

For random access ranges (which strings are) this uses an index based
algorithm, which does not need to create an intermediate slice. Speed
is now comparable to the nested-for-loop implementation even in rather
pathological cases.

This might help with issue 9646.
2016-06-02 21:44:50 +02:00
Steven Schveighoffer
e216c10b2c Merge pull request #4383 from JackStouffer/issue16073
Partial Fix for Issue 16073
2016-06-02 14:30:24 -04:00
Jack Stouffer
74398e70cf [Issue 16073] Fix incorrect uses of random access range primitives in std.algorithm.searching 2016-06-02 09:31:07 -04:00
Sebastian Wilzbach
1d34a121e9 apply all-man braces in Phobos
// find common cases
sed -E "s/^(\s*)((if|static if|for|foreach|foreach_reverse|while|unittest|switch|else|version).*)\s*\{$/\1\2\n\1{/" -i **/*.d
// catch else-if
sed -E "s/^(\s*)} (else static if| if|else if|else)(.*)\s*\{$/\1}\n\1\2\3\n\1{/" -i **/*.d
// remove created trailing whitespace
sed -i 's/[ \t]*$//' **/*.d
2016-05-31 13:07:53 +02:00
Sebastian Wilzbach
2dfbc51f17 Standardize whitespace after imports
Unified with:

sed -E "s/import\s*([^ ]+)\s*:\s*(.*(,|;))/import \1 : \2/" -i **/*.d
2016-05-29 22:09:56 +02:00
anonymous
641d6ff8d7 clean up remaining XREFs (manual)
Found by: grep -r '$(XREF'

std.experimental.allocator has a custom XREF2. Leaving that as is for now.
2016-05-27 21:40:46 +02:00
anonymous
ef9722928c XREF_PACK_NAMED -> REF_ALTTEXT (sed)
Done by:

arg='\s*([^(),]*)'
from='\$\(XREF_PACK_NAMED\s'$arg','$arg','$arg','$arg'\)'
to='$(REF_ALTTEXT \4, \3, std,\1,\2)'
(find . -type f -name "*.d" -print0; \
    find . -type f -name "*.dd" -print0) | \
xargs -0 sed -i -r "s/$from/$to/g"
2016-05-27 21:32:46 +02:00
anonymous
764caefa36 XREF -> REF (sed)
Done by:

(find . -type f -name "*.d" -print0; \
    find . -type f -name "*.dd" -print0) | \
xargs -0 sed -i -r \
    's/\$\(XREF\s+([^(),]*),\s*([^(),]*)\)/$(REF \2, std,\1)/g'
2016-05-27 21:32:46 +02:00
Sebastian Wilzbach
614294cd70 remove whitespace in ddoc output of std/algorithm 2016-05-25 03:57:01 +02:00
Andrei Alexandrescu
8f24656082 Merge pull request #4349 from nordlow/findSplit-opAssign
Fix Issue 15918
2016-05-24 09:04:48 -04:00
Per Nordlöw
54f05971e4 Fix Issue 15918 2016-05-24 09:37:36 +02:00
Vladimir Panteleev
38a6370788 Merge pull request #4303 from wilzbach/mref_phobos
use mref macro instead of link2
2016-05-24 03:12:08 +03:00
Robert Schadek
836a905833 Merge pull request #4312 from wilzbach/public_document_algorithms
std.algorithms: document public methods
2016-05-23 19:15:23 +02:00
Sebastian Wilzbach
89a2dd5f11 use mref macro instead of link2 2016-05-16 03:30:08 +03:00
Ilya Yaroshenko
b59ac8c2a8 remove useless CT branch 2016-05-12 17:29:49 +02:00
Sebastian Wilzbach
b8f17e2531 std.algorithms: document public methods 2016-05-12 17:53:03 +03:00
Sebastian Wilzbach
cc5e36d1b4 std.algorithm.searching - fix weird bug in Travis 2016-04-28 17:30:05 +03:00
Dmitry Olshansky
18dfffa07d Merge pull request #4221 from wilzbach/min_max_element
std.algorithm: {min,max}Element for a single range
2016-04-28 17:13:24 +04:00
Sebastian Wilzbach
e3d0aa9724 std.algorithm: {min,max}Element for a single range 2016-04-27 04:40:11 +03:00
Sebastian Wilzbach
3d67cd228c style fix: space between operators 2016-04-26 22:26:20 +03:00
Per Nordlöw
74deecc374 Update searching.d
Tag code with D ddoc tag.
2016-02-24 16:23:01 +01:00
Steven Schveighoffer
b0acb7a394 Fix remaining import deprecation messages 2016-02-22 16:03:12 -05:00
Jonathan M Davis
747135d6d6 Merge pull request #3954 from quickfur/canfind_docs
Add example of how to use a custom predicate with canFind.
2016-02-02 04:38:40 -08:00
H. S. Teoh
02c0083e1c Merge pull request #3942 from andralex/maxPos
Add maxCount and maxPos
2016-01-27 21:18:43 -08:00
H. S. Teoh
6a98d6ba03 Better variable naming. 2016-01-26 16:47:43 -08:00