mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
container: array: add type checks for passed arguments in insertAfter()
insertAfter should receive a valid element or a Range of values according to type T of the corresponding instance Array!T. Signed-off-by: Luís Ferreira <contact@lsferreira.net>
This commit is contained in:
parent
14b1c86f10
commit
ce558d26b1
1 changed files with 4 additions and 0 deletions
|
@ -1008,6 +1008,8 @@ if (!is(immutable T == immutable bool))
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
size_t insertAfter(Stuff)(Range r, Stuff stuff)
|
size_t insertAfter(Stuff)(Range r, Stuff stuff)
|
||||||
|
if (isImplicitlyConvertible!(Stuff, T) ||
|
||||||
|
isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, T))
|
||||||
{
|
{
|
||||||
import std.algorithm.mutation : bringToFront;
|
import std.algorithm.mutation : bringToFront;
|
||||||
enforce(r._outer._data is _data);
|
enforce(r._outer._data is _data);
|
||||||
|
@ -2199,6 +2201,8 @@ if (is(immutable T == immutable bool))
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
size_t insertAfter(Stuff)(Range r, Stuff stuff)
|
size_t insertAfter(Stuff)(Range r, Stuff stuff)
|
||||||
|
if (isImplicitlyConvertible!(Stuff, T) ||
|
||||||
|
isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, T))
|
||||||
{
|
{
|
||||||
import std.algorithm.mutation : bringToFront;
|
import std.algorithm.mutation : bringToFront;
|
||||||
// TODO: make this faster, it moves one bit at a time
|
// TODO: make this faster, it moves one bit at a time
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue