Joseph Rushton Wakeling
691efb167d
Make sure RNGs are passed to Random{Cover, Sample} by ref/auto ref.
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
40ee13749f
Ensure bool[] _chosen is filled with false at start of cover.
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
c000b794a6
Small stylistic tweaks for Andrei :-)
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
a3ead0ac31
Documentation updates for RandomCover and RandomSample.
...
Mostly regarding the statistical safety-related concerns
when passing a specified RNG, plus a few corrections.
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
c06ca0ce09
Unittests for RandomCover and RandomSample should test with all RNG types.
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
8e4b77fb3a
Correct the .save methods for RandomCover and RandomSample.
...
RandomCover and RandomSample should only be save'able if:
* the input is a forward range
* the thread-global RNG rndGen is not being used
* the RNG being used is a forward range.
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
2c9ecb8bd1
Partial fix for Issue 10434 - std.random.RandomSample
...
In line with changes to RandomCover, this patch tweaks
the choice of template parameter and variable names in
order to bring clarity and uniformity to the module.
2013-08-26 10:51:53 +02:00
Joseph Rushton Wakeling
8d9233cf8b
Partial fix for Issues 7067 and 10434 - std.random.RandomCover
...
The existing RandomCover design is fatally flawed because it
requires a RNG as input, which it then copies internally by
value. So, unless the user is smart enough to pass something
like e.g. SomeRNG(unpredictableSeed), there will be unintended
correlations in random behaviour.
This partial fix follows the design of RandomSample in allowing
RandomCover to use the thread-global default RNG rndGen. It
also improves the choice of template parameter and variable
names in line with Issue 10434.
2013-08-26 10:51:53 +02:00
monarch dodra
69ddf32feb
Merge pull request #1520 from tom-tan/safe-pure-string-removechars
...
Make std.string.removechars @safe and pure
2013-08-26 00:06:44 -07:00
Andrei Alexandrescu
f5e57ee8b5
Merge pull request #1484 from blackwhale/kill-back-eval
...
std.regex: First step to lookbehind in ctRegex
2013-08-25 18:14:49 -07:00
Tomoya Tanjo
927c5914a1
Make std.string.removechars @safe and pure by using implicit conversion
2013-08-25 23:32:04 +09:00
Tomoya Tanjo
3851d825ec
Make std.string.removechars @safe and pure
2013-08-25 22:52:13 +09:00
monarch dodra
09c8ebeeae
Merge pull request #1519 from tom-tan/safe-pure-string-countchars
...
Mark std.string.countchars as @safe and pure
2013-08-25 06:09:18 -07:00
Tomoya Tanjo
16de84e260
Mark std.string.countchars as @safe and pure
2013-08-25 20:48:18 +09:00
Tomoya Tanjo
7755589d09
Mark std.string.inPattern as @safe and pure
2013-08-25 20:27:33 +09:00
monarch dodra
1d50b6298e
Merge pull request #1513 from tom-tan/pure-string-justify
...
Mark leftJustify, rightJustify and center as pure
2013-08-25 00:21:58 -07:00
monarch dodra
3a3ca36340
Merge pull request #1496 from jerro/unix-domain-sockets
...
Fixed std.socket.UnixAddress
2013-08-25 00:06:40 -07:00
Tomoya Tanjo
11c559e822
Mark leftJustify, rightJustify and center as pure
2013-08-24 23:03:28 +09:00
Tomoya Tanjo
4498dbea84
Mark std.string.chop and its unittest as @safe and pure
2013-08-24 22:17:18 +09:00
monarch dodra
a184d6b484
Merge pull request #1505 from quickfur/issue10874
...
Issue 10874 - conv.to ulong to int enum conversion
2013-08-24 02:33:37 -07:00
monarch dodra
cbc684a001
Merge pull request #1504 from quickfur/bug6893
...
Issue 6893 - Write of enum member represented with ubyte or ulong
2013-08-24 01:44:59 -07:00
monarch dodra
a2c23948b6
Merge pull request #1510 from tom-tan/safe-pure-string-chompPrefix
...
Mark std.string.chompPrefix and its unittests as @safe and pure
2013-08-24 01:42:48 -07:00
monarch dodra
6d301e6678
Merge pull request #1508 from tom-tan/safe-pure-string-stripRight
...
Mark std.string.stripRight as @safe and pure
2013-08-24 01:42:02 -07:00
monarch dodra
a0dfcbcfad
Merge pull request #1509 from tom-tan/safe-pure-string-strip
...
Mark std.string.strip and its unittests as @safe and pure
2013-08-24 01:41:13 -07:00
Tomoya Tanjo
707f53ef06
Mark std.string.chompPrefix and its unittests as @safe and pure
2013-08-24 14:28:15 +09:00
Tomoya Tanjo
cefdd9859d
Mark std.string.strip and its unittests as @safe and pure
2013-08-24 12:23:44 +09:00
Tomoya Tanjo
aaeb96f4b2
Mark std.string.stripRight as @safe and pure
2013-08-24 12:07:31 +09:00
H. S. Teoh
d42e0eddec
Add unittest for narrowing enum -> integral conversions.
2013-08-23 11:03:52 -07:00
H. S. Teoh
8f8587f677
Allow narrowing conversions of enum -> integral (int, short, etc.).
...
It will just throw at runtime if the value of the enum is too large.
2013-08-23 11:03:52 -07:00
H. S. Teoh
b680614e57
Add unittest for issue 6893.
2013-08-23 11:03:47 -07:00
Johannes Pfau
20a60cf6f3
Fix frexp for real == double targets
2013-08-23 09:47:41 +02:00
H. S. Teoh
8536853fc8
Fix issue 10874.
...
Don't assume that is(A : B) means a==b is valid, or that !is(A : B)
implies that a==b is invalid. Instead, test for a==b explicitly.
More specifically, int and ulong are ==-comparable, even though ulong is
not implicitly convertible to int. Thus, one should be able to convert
ulong to an int-based enum, but is(A : B) in the signature constraint
prohibits this. Testing for a==b explicitly, OTOH, makes this work.
2013-08-22 21:01:10 -07:00
Andrej Mitrovic
c3d694e0fe
Add proper docs for return type of sformat.
2013-08-22 19:20:43 +02:00
Dmitry Olshansky
33c08b2f0f
fix broken indention, detab
2013-08-21 00:28:11 +04:00
monarch dodra
5c9aba062c
Merge pull request #1495 from tom-tan/safe-pure-unittest-for-stripLeft
...
Mark a unittest for std.string.stripLeft as @safe pure
2013-08-20 09:18:56 -07:00
ibuclaw
e778622f64
Fix floor/ceil for real==double targets.
2013-08-20 11:55:10 +01:00
Don Clugston
13cd90c1a9
Merge pull request #1426 from ibuclaw/puremath
...
True pure std.math
2013-08-20 00:11:55 -07:00
Jernej Krempuš
c3b1ac1c7d
Made the fix apply to all unices and added a unit test.
2013-08-20 01:34:57 +02:00
monarch dodra
7bc6e81539
Merge pull request #1433 from ntrel/byLine-take
...
Fix Issue 9599 - File.byLine doesn't function properly with take
2013-08-19 10:50:12 -07:00
monarch dodra
5410c2d268
Merge pull request #1486 from tom-tan/safe-string-indexOf
...
Make std.string.indexOf @safe
2013-08-19 07:53:39 -07:00
Nick Treleaven
6de39acc16
Change foreach byLine example to use take
...
Also remove 'If Char is mutable' because (currently) Char can't be
immutable.
2013-08-19 15:24:01 +01:00
Nick Treleaven
dad4b53686
Don't let ByLine degenerate to a ByLineImpl
2013-08-19 15:23:59 +01:00
Nick Treleaven
ec1f0fdb9d
Fix Issue 9599 - File.byLine doesn't function properly with take
...
Calling take could wrongly pop an extra line from the range.
Solved by making ByLine use reference-counting.
Note: Just changing ByLine not to eagerly read the next line was not
sufficient to handle all cases properly (plus that makes empty() less
efficient).
Note: ByLine was documented until recently.
2013-08-19 15:23:57 +01:00
Nick Treleaven
6061d747e4
Don't assume wrapped range has a const empty()
2013-08-19 15:23:55 +01:00
Nick Treleaven
8ff4bff0da
Fix unreferencing ByLine.file once empty
...
The file handle was not released for an empty text file.
Also, do not pretend empty() is const.
2013-08-19 15:23:53 +01:00
Nick Treleaven
4c2a8bea35
Add unittest for issue 9599, plus some other byLine cases
2013-08-19 14:45:09 +01:00
Tomoya Tanjo
b1b00243e1
Mark a unittest for std.string.stripLeft as @safe pure
2013-08-19 22:02:13 +09:00
Tomoya Tanjo
937fe1fdb3
Mark std.string.splitLines as @safe pure
2013-08-19 21:39:37 +09:00
Tomoya Tanjo
f99a647139
Add cast to Char*
2013-08-19 20:34:41 +09:00
Jernej Krempuš
7006ac9d1f
Made unix domain sockets work on Linux.
2013-08-18 22:32:55 +02:00