Expose any, all on Array and all the Lazy sequence adapters. Make the
'contains' algorithm that takes a predecate unavailable in favor of
'any', which does the same thing.
Fixes <rdar://problem/18190149> [algorithm] `contains` syntax is ambiguous
Swift SVN r21810
To limit user confusion when using conditional expressions of type Bool?, we've decided to remove the BooleanType (aka "LogicValue") conformance from optional types. (If users would like to use an expression of type Bool? as a conditional, they'll need to check against nil.)
Note: This change effectively regresses the "case is" pattern over types, since it currently demands a BooleanType conformance. I've filed rdar://problem/17791533 to track reinstating it if necessary.
Swift SVN r20637
Even if the user supplies an ordering predicate that isn't a strict-weak
ordering, algorithms should not index beyond their bounds. Otherwise, a
use of withUnsafeMutableStorage for optimization purposes could easily
do an unsafe memory access.
This commit comments and tests our algorithms that require strict weak
orderings, and fixes safety problems in partition(). Most benchmarks
are unaffected, but the rewrite of partition produces a 27% speedup in
the Phonebook benchmark at -O3 and a 22% speedup at -Ofast.
Also, at -Ofast, QuickSort lost 6% and RC4 gained 6%. These benchmarks
were not noticeably affected at -O3
====================`PrecommitBench_O3`====================
````benchmark`,`baserun0`,`baserun1`,`baserun2`,``optrun0`,``optrun1`,``optrun2`,``delta`,`speedup`
````Phonebook`,``1608.00`,``1676.00`,``1651.00`,``1265.00`,``1278.00`,``1281.00`,`343.00`,```27.1%`
````QuickSort`,```430.00`,```448.00`,```429.00`,```428.00`,```431.00`,```428.00`,```1.00`,````0.2%`
``````````RC4`,```925.00`,```924.00`,```922.00`,```916.00`,```919.00`,```917.00`,```6.00`,````0.7%`
====================`PrecommitBench_Ofast`====================
````benchmark`,`baserun0`,`baserun1`,`baserun2`,``optrun0`,``optrun1`,``optrun2`,``delta`,`speedup`
````Phonebook`,``1521.00`,``1546.00`,``1591.00`,``1252.00`,``1255.00`,``1256.00`,`269.00`,```21.5%`
````QuickSort`,```478.00`,```477.00`,```476.00`,```506.00`,```510.00`,```513.00`,``30.00`,```-5.9%`
``````````RC4`,``1033.00`,``1874.00`,``1030.00`,```974.00`,```982.00`,```975.00`,``56.00`,````5.7%`
Swift SVN r20202
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able." Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.
There are obvious improvements to make in some of these names, which can
be handled with separate commits.
Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.
Swift SVN r19883
Fixes <rdar://problem/17028678> comments for sort() don't make sense in
the synthesized header. Putting the right comments in there is
<rdar://problem/17511801> Algorithm.swift needs doc comments
Swift SVN r19370
This API exposes unmediated access to memory, and most users will never
see the UnsafeArray argument that's passed to the closure, so best to be
explicit.
Swift SVN r19243
Keep calm: remember that the standard library has many more public exports
than the average target, and that this contains ALL of them at once.
I also deliberately tried to tag nearly every top-level decl, even if that
was just to explicitly mark things @internal, to make sure I didn't miss
something.
This does export more than we might want to, mostly for protocol conformance
reasons, along with our simple-but-limiting typealias rule. I tried to also
mark things private where possible, but it's really going to be up to the
standard library owners to get this right. This is also only validated
against top-level access control; I haven't fully tested against member-level
access control yet, and none of our semantic restrictions are in place.
Along the way I also noticed bits of stdlib cruft; to keep this patch
understandable, I didn't change any of them.
Swift SVN r19145
This is motivated by <rdar://problem/17051606>.
This ends up renaming variables as well, which seems right for
consistency since we use "predicate" as variable name.
Swift SVN r19135
Sorting was a bit of a mess; we had sort functions doing in-place
mutation /and/ returing the value, and people were confused by the
asymmetry of Array's sort() method with other higher-level methods.
Fixes <rdar://problem/17185815> sort([]T, f) mutates the original array
<rdar://problem/17225190> The Array.sort() method should return a sorted array
Swift SVN r18922
This helps array append's performance by ~ 2x. The generic max with a variadic
argument takes at least 3 arguments, it creates a temporary array then iterates
over the array.
This is an updated version of r18764.
rdar://17140639 rdar://17073827
Swift SVN r18767
This helps array append's performance by ~ 2x. The generic max with a variadic
argument creates a temporary array then iterates over the array.
rdar://17140639 rdar://17073827
Swift SVN r18764