mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 16:10:45 +03:00
among should be @safe
This commit is contained in:
parent
3cd14f0bb6
commit
6c79c245d0
1 changed files with 4 additions and 4 deletions
|
@ -14348,7 +14348,7 @@ template among(values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
assert(3.among(1, 42, 24, 3, 2));
|
assert(3.among(1, 42, 24, 3, 2));
|
||||||
|
|
||||||
|
@ -14365,13 +14365,13 @@ unittest
|
||||||
Alternatively, $(D values) can be passed at compile-time, allowing for a more
|
Alternatively, $(D values) can be passed at compile-time, allowing for a more
|
||||||
efficient search, but one that only supports matching on equality:
|
efficient search, but one that only supports matching on equality:
|
||||||
*/
|
*/
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
assert(3.among!(2, 3, 4));
|
assert(3.among!(2, 3, 4));
|
||||||
assert("bar".among!("foo", "bar", "baz") == 2);
|
assert("bar".among!("foo", "bar", "baz") == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
if (auto pos = 3.among(1, 2, 3))
|
if (auto pos = 3.among(1, 2, 3))
|
||||||
assert(pos == 3);
|
assert(pos == 3);
|
||||||
|
@ -14481,7 +14481,7 @@ auto predSwitch(alias pred = "a == b", T, R ...)(T switchExpression, lazy R choi
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
string res = 2.predSwitch!"a < b"(
|
string res = 2.predSwitch!"a < b"(
|
||||||
1, "less than 1",
|
1, "less than 1",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue