Commit graph

559 commits

Author SHA1 Message Date
monarchdodra
6c98c325f9 safe pure nothrow sort and sum 2014-04-09 18:48:24 +02:00
monarchdodra
6123ca3371 Fix Issue 12434 - std.algorithm.sum of immutable array too
https://d.puremagic.com/issues/show_bug.cgi?id=12434

Simply uses the inference's `Unqual` type as a seed, rather than the straight up result.

Also add some unittesting while at it.
2014-04-07 07:48:53 +02:00
Dmitry Olshansky
98434a5181 Merge pull request #2052 from monarchdodra/copyAssert
Add asserts in Copy (and remove an enforce)
2014-03-30 23:50:27 +04:00
Dmitry Olshansky
66fd049ea9 Make move CTFEable for simple structs and classes
memcpy is not CTFEable, so avoid it for structs without
dtor, postblit that can be assigned with plain =.

This leaves as is (compile error in CTFE) structs that contain
immutable/const memebers the fact that moves overwrites such
fields is questionable to begin with.
2014-03-28 00:24:21 +04:00
monarch dodra
dacbef4c98 Add asserts in Copy (and remove an enforce)
Adding extra asserts always helps. As for the enforce, I'm unsure why it was there in the first place: All the other branches simply make the assumption the target is large enough.
2014-03-27 18:49:12 +01:00
Andrei Alexandrescu
cecd745cef Merge pull request #2015 from monarchdodra/emplaceQual
Improve emplaceRef for qualified construction
2014-03-26 18:03:39 -07:00
monarch dodra
4e4f73b646 Remove pointsTo in move
as well as remove erroneous documentation.
2014-03-25 21:21:33 +01:00
monarch dodra
782441ee1d Fixup for 9975: swap and pointsTo
Fixing 9975 revealed that checking `pointsTo` was creating problems in swap for legitimate use cases.

This is because:
1. pointsTo can sometimes create "false positives"
2. Internal pointing is not outright forbidden, it is just that the runtime is allowed to make the assumption they don't exist.

While swapping aliasing objects is a sign of stink, it should still "just work".
2014-03-25 21:21:33 +01:00
monarch dodra
aec513e542 Revert 2014-03-24 16:39:56 +00:00
monarch dodra
72d78547cf Update algorithm.d 2014-03-24 16:16:19 +00:00
monarch dodra
7f76f3fc3a Update algorithm.d 2014-03-24 16:13:29 +00:00
monarch dodra
8370276924 Fix Issue 12449
Undefined format in std.algorithm.max
2014-03-24 13:41:44 +00:00
Andrei Alexandrescu
9404dd477f Merge pull request #1970 from monarchdodra/sumseed
Give sum a seed capability
2014-03-19 18:08:06 -07:00
monarchdodra
59ad77ad9f Improve emplaceRef for qualified construction 2014-03-17 22:48:30 +01:00
monarchdodra
69d181290c Remove incorrect save 2014-03-14 22:41:34 +01:00
k-hara
6f80f6aa03 Add more local imports 2014-03-13 13:13:04 +09:00
monarch dodra
9231bdd0b3 Tweak map's save
Not only does it avoid opAssign issues, but the final code is simpler anyways.
2014-03-12 11:53:21 +01:00
Geod24
4ed10be8bc Fix issue 12183 : Avoid using floating point in std.algorithm.sort.
- Prevent valgrind from aborting (some x87 FP operation are not supported).
- Can be slower on machines that have a soft floating point ABI.
2014-03-11 10:58:29 -07:00
monarchdodra
423f889580 Give sum a seed capability 2014-03-10 07:44:44 +01:00
Yazan S. Dabain
b8c29046f8 [Trivial] Fix documentation typos in std.algorithm 2014-02-28 10:37:44 +02:00
monarch dodra
4d16df5a73 Add sum to std.algorithm's TOC 2014-02-27 10:05:51 +01:00
monarch dodra
920d8c7651 Fixup sum documentation 2014-02-26 11:09:24 +01:00
monarchdodra
e5c10ca4ab Fix issue 12169 - sum(int[]) should return a int 2014-02-25 21:07:44 +01:00
Daniel Murphy
4d0892baba Remove uses of the comma operator 2014-02-18 00:48:40 +11:00
monarchdodra
9ba09aa59c change emplace for emplaceRef in algorithm 2014-02-16 17:04:34 +01:00
monarchdodra
95152081f3 swap isAssignable and !hasElaborateAssign 2014-02-16 17:04:34 +01:00
monarch dodra
acdb1d0a9a Merge pull request #1205 from andralex/4725
Fix Issue 4725 - std.algorithm.sum()
2014-02-15 08:20:01 +01:00
Andrej Mitrovic
4aab80ef53 Merge pull request #1461 from monarchdodra/issue10039
Fix Issue 10039 - std.algorithm enhancements: min, max, clamp
2014-02-14 22:27:05 +01:00
monarchdodra
01ef8978c2 Improve min/max recursion 2014-02-14 19:55:25 +01:00
Peter Alexander
cef8d54a7b Fix Issue 5753 - Disallow map with void function.
https://d.puremagic.com/issues/show_bug.cgi?id=5753
2014-02-12 18:49:40 +00:00
k-hara
b391b2ec9f Convert to new alias syntax 2014-02-11 15:27:05 +09:00
monarchdodra
9d33fb078d Coverage for minCount 2014-02-09 20:37:15 +01:00
Andrej Mitrovic
490d34d1e8 Merge pull request #1905 from CyberShadow/std-algorithm-docs
std.algorithm: Documentation fixes
2014-02-03 10:09:39 -08:00
Vladimir Panteleev
b757dcea75 std.algorithm: Add missing entries to module documentation summary 2014-02-03 17:25:47 +00:00
Vladimir Panteleev
5529d8205a std.algorithm: Fix alphabetical order of declarations 2014-02-03 17:25:47 +00:00
Vladimir Panteleev
bb0ee5ffef std.algorithm: Link to top-level symbols
Fixes ambiguous link to "remove".
2014-02-03 17:25:46 +00:00
k-hara
c68cb5dc6c Move isBlitAssignable to std.traits 2014-01-31 13:07:33 +09:00
k-hara
4dd0668f60 Fix union case 2014-01-31 13:07:31 +09:00
k-hara
2d32c78af4 fix Issue 12024 - template instantiation for swap(SysTime, SysTime) fails 2014-01-31 13:07:28 +09:00
Robert burner Schadek
c0032f9e2f examples of algorithm usage 2014-01-28 16:01:00 +01:00
Andrei Alexandrescu
637bd45413 pairwise sum returns double for ranges with float elements 2014-01-25 14:42:37 -08:00
Andrei Alexandrescu
7783916096 Added LREF to sum in reduce 2014-01-25 14:00:59 -08:00
Andrei Alexandrescu
ed36e854ef Document use of Kahan vs. vanilla summation 2014-01-25 14:00:59 -08:00
Andrei Alexandrescu
1564671ace Fix Issue 4725 - std.algorithm.sum() 2014-01-25 14:00:59 -08:00
Andrei Alexandrescu
bcf2be7b9c Merge pull request #1878 from WalterBright/fix11973
fix Issue 11973 - Please use any instead
2014-01-24 23:26:33 -08:00
Walter Bright
7e458cc432 fix Issue 11973 - Please use any instead 2014-01-23 23:38:48 -08:00
Daniel Murphy
a656f26e9e Remove use of automatic adjacent string literal concatenation from phobos 2014-01-20 03:42:21 +11:00
Andrei Alexandrescu
6732bbb835 Merge pull request #1858 from CyberShadow/std-aglorithm-sort-nonassignable
std.algorithm: Remove the hasAssignableElements restriction from HeapSortImpl
2014-01-16 09:35:54 -08:00
Vladimir Panteleev
4e6e09c568 std.algorithm: Add test for sorting via proxySwap 2014-01-14 20:00:42 +00:00
Vladimir Panteleev
9e14a1f6ef std.algorithm: Allow proxySwap-using swap overload to take by ref 2014-01-14 20:00:41 +00:00