Commit graph

77 commits

Author SHA1 Message Date
Dmitry Olshansky
6c7b9a0697 Another attempt to generalize insertInPlace. 2011-06-15 02:04:08 +04:00
Dmitry Olshansky
2ef493e6c3 Variadic insertInPlace for strings & chars. 2011-06-13 03:36:58 +04:00
Dmitry Olshansky
9e43abfa09 Make insertInPlace more versatile 2011-06-10 13:47:36 +04:00
Andrei Alexandrescu
d061f13d34 https://github.com/D-Programming-Language/phobos/pull/23 2011-05-01 12:11:46 -05:00
jmdavis
7d98998c57 Merged in Pull Request #14 for D-Programming-Language / phobos. 2011-04-16 00:31:30 -07:00
Andrei Alexandrescu
055cea0595 Merge branch 'master' of github.com:D-Programming-Language/phobos
Conflicts:
	posix.mak
2011-04-06 00:32:29 -05:00
jmdavis
b04b99629f Changes to std.array per suggestions on pull request #14 of D-Programming-Language / phobos. 2011-02-27 17:02:05 -08:00
Andrei Alexandrescu
1083bd4e7b One pass through std.range and friends
* Made emplace faster and replaced calls to it to also make them faster.

* Replaced phobos.d in posix.mak with index.d.

* Added version=StdDdoc to documentation build in posix.mak, and replaced uses of D_Ddoc with it.

* Improved documentation target in posix.mak (target dir automatically created).

* Added nice documentation table and cheat sheet at the top of std.algorithm.

* Replaced a few helper structs in std.range and std.algorithm with local structs, which simplify matters a fair amount.

* Added more constraints to functions in std.algorithm (still work in progress).

* Improved error message in std.algorithm.sort in case of failure to sort.

* std.random.dice(1, 10) now works (no need for array notation std.random.dice([1, 10])).

* Fixed documentation bugs and insufficiencies in std.range (still more to do).

* Improved speed of walkLength.

* Simplified retro.

* Simplified and optimized stride. Also folded stride(stride(r, a), b) into stride(r, a * b).

* Added roundRobin to std.range, which as a perk simplified radial.

* Added takeOne and takeNone to std.range.

* Added unsigned to std.traits.
2011-02-27 12:38:49 -06:00
jmdavis
a7a39f2003 Some improvements to std.array.
In particular, functions which make changes in place have now been
renamed to have InPlace in their name as discussed on the newsgroup
(with versions with the old names scheduled for deprecation). I also
created versions for those functions which do _not_ do the changes in
place, but in at least a couple of cases, they had to be left commented
out until the old versions which do make the changes in place have
actually been removed. I'd love to just remove the old versions, but
that would silently break code, so tough luck for now.
2011-02-27 04:36:47 -08:00
Andrei Alexandrescu
31d47df17f readded std/array.d 2011-02-26 19:14:13 -06:00
Andrei Alexandrescu
db5b27dcd2 Merge branch 'jmdavis-red-black'
Conflicts:
	std/array.d
2011-02-26 18:54:43 -06:00
Walter Bright
1b8314c4e0 add source links 2011-02-26 15:32:21 -06:00
Lars T. Kyllingstad
be80d2b665 Issue 4807 - Examples for std.array insert and replace 2011-02-26 15:32:20 -06:00
jmdavis
1a3c750902 Merge branch 'master' of https://github.com/kyllingstad/phobos into kyllingstad-master 2011-02-09 12:08:57 -08:00
Walter Bright
046e1b36db add source links 2011-02-06 15:46:50 -08:00
Lars T. Kyllingstad
00e78b8dd2 Issue 4807 - Examples for std.array insert and replace 2011-02-03 11:47:32 +01:00
Andrei Alexandrescu
9e15909243 Fix for issue 5152 2011-01-22 23:56:12 +00:00
Andrei Alexandrescu
2e7fb2eba2 Added replaceFirst 2011-01-22 21:19:26 +00:00
Andrei Alexandrescu
cd06db7fe7 Changed replaceInPlace back to replace as it cannot be confused 2011-01-22 03:54:45 +00:00
Andrei Alexandrescu
272ceaa9a6 Improvements to replicate(); documented splitter() for strings; renamed replace() in place to replaceInPlace(); removed replace() that takes void* in the last position; moved replace() from string to array and generalized it; attached constraint to functional.not; more cleanup of std.string; improved std.algorithm.util and count to accept ranges; improved constraint in std.algorithm.remove 2011-01-21 08:39:39 +00:00
Andrei Alexandrescu
8b361fb217 Moved replace from string to array 2011-01-19 09:04:29 +00:00
Andrei Alexandrescu
331dd3a489 Moved split from string to array, made one more pass through array 2011-01-19 06:44:46 +00:00
Andrei Alexandrescu
cf33c1999a Moved join from std.string to std.array, plus a few cosmetic changes 2011-01-17 20:43:54 +00:00
Steven Schveighoffer
f20359168a Fixed reserve function to use GC.extend when possible. 2010-12-27 19:40:19 +00:00
Steven Schveighoffer
4435b311eb Fixed std.array.Appender so it uses the newcapacity function to determine grow size when appending a range. Previously, it just grew enough to fit the range contents, which does not amortize appending performance.
Now, appending a range beats builtin append.  I noticed that appending a range does not beat appending single elements when the size of the range is small (such as one element).  There are probably heuristics we can find to optimize the copying, but I have a feeling these should just go into the builtin array copy code anyways.

Fixes bugzilla 5198
2010-12-27 19:02:40 +00:00
Don Clugston
84477a5d3e Move Boost copyright declaration from ddoc to normal comment. Fixes ugly ddoc output. 2010-11-24 19:34:47 +00:00
Shin Fujishiro
af1fb0b618 Constrain swap() with isMutable!T so that const objects should not be swapped. std.traits.isMutable is undocumented for now. 2010-11-18 21:45:18 +00:00
Shin Fujishiro
85b5c42510 Made std.array empty(), save() and overlap() "@safe pure nothrow".
overlap: nested functions min() and max() are ad-hoc workaround to make the function pure nothrow.

front(), back(), popFront() and popBack() depend on std.utf, and they are unchanged for now.
2010-11-18 21:25:55 +00:00
Lars T. Kyllingstad
5264901ff4 Bug 5163: meaningless error message with front() applied to void[]
It's not possible to index into void[] arrays, which means that they
cannot be ranges.  Therefore, I've added template constraints to
front(), back(), popFront(), and popBack() in std.array that prevents
them from being instantiated with void[].
2010-11-05 12:12:55 +00:00
David Simcha
b597d23f83 Bug 4888: Heavy reliance on Bug 3534 in Phobos range usage. I used a different approach here than the first one I tried. I only did what was necessary to make Phobos work instead of trying to fix the deeper issue of making std.algorithm to work w/ const/immutable arrays. 2010-09-18 21:00:52 +00:00
David Simcha
1ec0042c6c Fix bug where opApply iterables with length can't be converted to arrays. 2010-09-14 23:09:40 +00:00
Andrei Alexandrescu
eb6b17f27b Fix Appender to accept input ranges 2010-09-13 13:36:52 +00:00
David Simcha
8a50942419 Fix memory corruption bug in std.array caused by having GC block attributes backwards. 2010-09-08 21:18:12 +00:00
Steven Schveighoffer
7641283d44 Removed cases for RefAppender where passed in array pointer is null. No point to do that, since you could just use the Appender directly instead. 2010-09-07 13:13:39 +00:00
Steven Schveighoffer
f5565aec67 Added RefAppender wrapper to appender that simulates original functionality (updates a reference when array is appended to) 2010-09-07 12:02:36 +00:00
Steven Schveighoffer
6636569318 changed appender to prevent calling .clear on appenders of immutable or const data.
Removed buffer arg from std.xml.encode since most of the time the data is string data, and the buffer was defined as the same type.

Fixed std.format unittests to not use string-based appenders, since they now cannot be rewritten.
2010-08-26 19:05:09 +00:00
Steven Schveighoffer
399d8c0eaa Upon discussion in the appender access bug, it was determined we could make the Appender able to use the entire memory block, not just the data passed in.
With this fix, Appender and builtin appending should both be callable on the same data without corruption, of course using the builtin append on data held
by an Appender will reallocate.
2010-08-26 17:04:44 +00:00
Steven Schveighoffer
7e89201cda Rewrote Appender to be safer and to not corrupt memory.
Fixed all places that use appender to use the safer interface.
bugzilla 4681: Appender access violation
2010-08-26 11:49:50 +00:00
Andrei Alexandrescu
3f2b8c12ea 64-bit compatibility work 2010-08-22 20:55:22 +00:00
David Simcha
d51ceb4c29 Bug 4346: More flexible std.array.array. Also improve std.array.array to work better with immutable narrow strings and use emplace() instead of placement new. 2010-08-19 00:53:05 +00:00
Andrei Alexandrescu
3c4c5bc25a Different implementation of capacity in Appender 2010-08-08 01:11:05 +00:00
Andrei Alexandrescu
6dc8c7ad3f Saved capacity properly after each append 2010-07-28 07:50:50 +00:00
Andrei Alexandrescu
2da8c7920e Removed put for arrays 2010-07-12 00:46:16 +00:00
David Simcha
7d9a0eb0c9 array() should work with input ranges. 2010-07-11 23:55:22 +00:00
Andrei Alexandrescu
125345ba2f Removed specialization of put(a, e) for array and object because the definition in std.range fulfills it 2010-07-09 03:50:31 +00:00
Andrei Alexandrescu
536cb93d9c Fixed issue in Appender 2010-07-06 05:34:59 +00:00
Andrei Alexandrescu
432e3fdfc8 Replaced std.contracts with std.exception throughout 2010-07-04 22:09:03 +00:00
Andrei Alexandrescu
93a828c06b Temporary workaround for bug 4426 2010-07-04 21:13:07 +00:00
Andrei Alexandrescu
875d77e732 Made Appender a reference type by encoding capacity at the end of the store 2010-07-04 19:57:04 +00:00
David Simcha
19b57eecf4 std.array.back(): enforce -> assert. 2010-07-03 13:50:21 +00:00