mirror of
https://github.com/dlang/phobos.git
synced 2025-05-07 19:49:36 +03:00
Remove template wide trusted in std.array
This commit is contained in:
parent
6c11b77dbc
commit
cd197654e7
1 changed files with 5 additions and 5 deletions
10
std/array.d
10
std/array.d
|
@ -229,15 +229,15 @@ Returns:
|
||||||
a `dchar[]`, `const(dchar)[]`, or `immutable(dchar)[]` depending on the constness of
|
a `dchar[]`, `const(dchar)[]`, or `immutable(dchar)[]` depending on the constness of
|
||||||
the input.
|
the input.
|
||||||
*/
|
*/
|
||||||
@trusted ElementType!String[] array(String)(scope String str)
|
ElementType!String[] array(String)(scope String str)
|
||||||
if (isNarrowString!String)
|
if (isNarrowString!String)
|
||||||
{
|
{
|
||||||
import std.utf : toUTF32;
|
import std.utf : toUTF32;
|
||||||
/* This function is @trusted because the following cast
|
auto temp = str.toUTF32;
|
||||||
* is unsafe - converting a dstring[] to a dchar[], for example.
|
/* Unsafe cast. Allowed because toUTF32 makes a new array
|
||||||
* Our special knowledge of toUTF32 is needed to know the cast is safe.
|
and copies all the elements.
|
||||||
*/
|
*/
|
||||||
return cast(typeof(return)) str.toUTF32;
|
return () @trusted { return cast(ElementType!String[]) temp; } ();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue