Commit graph

493 commits

Author SHA1 Message Date
Tomoya Tanjo
b059f51751 Update unittests 2013-08-03 20:16:46 +09:00
Tomoya Tanjo
f6b41a55eb Fix array to make it surely safe for some cases 2013-08-03 20:03:01 +09:00
Tomoya Tanjo
1f016bbcc0 Some fixes according to the comments by @ monarchdodra 2013-07-23 23:37:14 +09:00
Tomoya Tanjo
c5218dd33b Fix the arguments of sameTail and make sameHead and sameTail @safe 2013-07-22 21:48:35 +09:00
Tomoya Tanjo
4581999a3c Make std.array.array @safe if possible 2013-07-20 17:17:19 +09:00
k-hara
87bd3315db fix Issue 10230 - Duplicated buttons for runnable examples 2013-07-16 00:45:48 +09:00
k-hara
a4d71338f9 [appender] Mark pointer slicing @trusted (fix for issue 10359) 2013-06-20 11:13:52 +09:00
k-hara
9cdfd6899a [appender] Determine @trusted operations 2013-06-20 10:54:37 +09:00
k-hara
99d22b80f6 [appender] Accepting qualified buffer is not safe behavior
To reduce existing code breaking, mark such construction as @system.
2013-06-20 10:54:35 +09:00
k-hara
41098e3f49 [appender] Reuse ensureAddable for reserve implementation
AFAICS, they have mostly same code.
2013-06-20 10:54:33 +09:00
k-hara
ed03c4af01 Fix trivial nitpicks 2013-06-20 10:54:20 +09:00
Denis Shelomovskij
51a5bad3e6 Improve Issue 10220 fix.
Improves pull #1329.

Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=10220
2013-06-05 18:43:47 +04:00
k-hara
924232603a fix Issue 10220 - array doesn't work with disabled default construction 2013-06-02 02:32:53 +09:00
k-hara
e2d991b005 Move checkCTFEable to std.exception.assertCTFEable, and use it 2013-06-02 02:32:24 +09:00
Dylan Knutson
5294809f53 fix for calling .array() on ranges in CTFE 2013-05-25 23:46:51 -07:00
k-hara
fa3c481ba7 fix Issue 10122 - Appender doesn't work with disabled default construction 2013-05-21 00:14:00 +09:00
k-hara
8083744164 [Trivial] fix code style 2013-05-20 22:40:44 +09:00
Ferdinand Majerech
b8d98efd2d DDoc (minor): array.d: Appender.shrinkTo throws Exception
Specified that Exception gets thrown (the previous ddoc didn't make sense).
2013-04-20 15:22:56 +03:00
k-hara
53640bf046 fix Issue 9836 - std.array.popFront does not work with alias this.
empty, front, popFront, back, popBack should work with alias this type.
2013-04-05 22:33:05 +09:00
Vladimir Panteleev
0b1f86119a std.array: Fix inefficient appending of const(char)[] (Issue 9725) 2013-03-15 04:40:14 +00:00
Andrej Mitrovic
92b7d19000 Fixes Issue 4287 - Implement concat-assign operator for Appender. 2013-02-07 18:49:53 +01:00
Andrej Mitrovic
10745625bc Detab std.array. 2013-02-07 18:49:01 +01:00
Peter Alexander
9d8c78d180 Changed foreach to for to avoid copies + cleanup 2012-12-30 17:15:09 +00:00
Peter Alexander
d24519ee47 More improvements and optimisations to array.join 2012-12-28 17:29:43 +00:00
Peter Alexander
83cf1854db Fix for non-array separators for non-string RoR. 2012-12-27 17:57:29 +00:00
Peter Alexander
221ea836fa Convert sep to array for performance/generality. 2012-12-27 16:38:26 +00:00
Peter Alexander
b6c9ffed91 Fix for mismatched string types + added unittests. 2012-12-27 02:06:06 +00:00
Peter Alexander
ceda4e2880 std.array.join refactor.
tl;dr: std.array.join was quite complicated: 6 implementation functions, and a few hundred lines of code. Now it is just 2 functions, ~120 lines of code smaller, and within 10% performance of original (faster in some cases).

The original had 6 implementations: 3 joins with a separator, 3 without. For each, those 3 consisted of:
* A general slow version (uses `std.algorithm.joiner` with `appender`).
* A version for a range of arrays where you know the length (pre-allocates the destination array then uses array ops).
* A version for a range of arrays where you don't know the length (uses `appender`).

There's no need for the second version because you can just use appender and `.reserve` the size upfront. Appender already uses array ops when available in its `put` function.

There's also no need for the first function because using `joiner` is slower than just looping through the sub-ranges, appending them. The third function doesn't even use the fact that its operating on a range of arrays, so it can easily be merged with the first and second.

The end result is just one function for join with a separator, and one for a join without. They both use `appender`, and have a static branch that will `.reserve` the required size when the information is available.
2012-12-26 18:46:22 +00:00
Peter Alexander
25abd874d1 Simplified std.array.join with separator.
Previously, std.array.join with a separator would check whether it needed to add the separator on each iteration of the loop. With this change, the check is unnecessary because the first element is appended before the loop, then the loop just adds the separator and next element each iteration.

This improves the code significantly in the case of a non-forward RoR because we don't need to know the length anymore. It's simpler, and will be slightly faster.
2012-12-25 19:20:15 +00:00
Dmitry Olshansky
9e35a4d8ee address review remarks 2012-12-13 20:48:24 +04:00
Dmitry Olshansky
222c803536 re-style and fix indention 2012-12-13 20:41:21 +04:00
Dmitry Olshansky
b7286e7444 generalize countLength 2012-12-13 20:41:20 +04:00
Dmitry Olshansky
96a22304d8 another -property error 2012-12-13 20:41:20 +04:00
Dmitry Olshansky
016a55a561 structs with postblit, CTFE, fix -property 2012-12-13 20:41:19 +04:00
Dmitry Olshansky
14e457b37d fix issue 4489 std.array.insert is slow 2012-12-13 20:41:19 +04: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
Alex Rønne Petersen
c850e68b03 Merge pull request #930 from epi/master
Added assocArray()
2012-12-09 11:33:59 -08:00
k-hara
07104b5fe6 Add alias opDollar and use $ in range slicing 2012-12-05 10:13:17 +09:00
k-hara
28dedee456 Issue 7444 - Require [] for array copies too 2012-11-20 17:55:21 +09:00
Jonathan M Davis
1536320ca1 Merge pull request #905 from monarchdodra/strip
strip and sameTail
2012-11-15 22:46:33 -08:00
Adrian Matoga
383f77c5ce fixed misleading doc for assocArray() 2012-11-14 11:02:27 +00:00
Adrian Matoga
908c1763e1 cleaner template constraints for assocArray() 2012-11-06 11:53:45 +00:00
Adrian Matoga
908680f6d4 Added assocArray() 2012-11-06 10:55:20 +00:00
Andrej Mitrovic
6f65897a6a Add comment about overlap being undocumented on purpose. 2012-11-02 15:10:49 +01:00
monarch dodra
b04b0695a3 Unittests for sameHead/sameTail 2012-10-28 11:54:33 +01:00
monarch dodra
efed1a0e36 Adding sameTail 2012-10-28 11:54:32 +01:00
monarch dodra
425c9d2b9f Allow R values with sameHead
Not much point in passing arrays by const ref when you can just pass by copy.
2012-10-28 11:16:28 +01:00
monarch dodra
8cb3c314d0 remove ctfe check in popFront!NarrowString 2012-10-16 12:56:08 +03:00
jmdavis
735c2adbda Changes required for issue# 6277. 2012-07-21 01:57:28 -07:00
Andrei Alexandrescu
70dcb958ea Merge pull request #661 from jmdavis/popFront
Performance improvements for popFront and narrow strings.
2012-07-15 20:35:09 -07:00