| Thread overview | |||||
|---|---|---|---|---|---|
|
March 01, 2021 Remove elements from char[] throws error | ||||
|---|---|---|---|---|
| ||||
Consider this small program:
import std.stdio;
import std.algorithm;
void main() {
char[] a = ['a', 'b', 'c', 'd', 'e'];
writeln(remove(a, 1, 3));
}
DMD compiles this fine. But GDC throws the following error:
error: no overload matches for remove
writeln(remove(a, 1, 3));
^
Though calling 'remove' with int[] works just fine.
I am new to D (but not to programming in general). Is it a GDC bug? If not, how to avoid this error?
| ||||
March 01, 2021 Re: Remove elements from char[] throws error | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Mark Lagodych | On Monday, 1 March 2021 at 17:05:18 UTC, Mark Lagodych wrote:
> DMD compiles this fine. But GDC throws the following error:
gdc bundles an older version of the std library, so that particular overload was probably added more recently.
You could possibly `cast(ubyte[]) a` in there to select a different overload.
| |||
March 01, 2021 Re: Remove elements from char[] throws error | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 1 March 2021 at 17:16:11 UTC, Adam D. Ruppe wrote:
> On Monday, 1 March 2021 at 17:05:18 UTC, Mark Lagodych wrote:
>> DMD compiles this fine. But GDC throws the following error:
>
> gdc bundles an older version of the std library, so that particular overload was probably added more recently.
>
> You could possibly `cast(ubyte[]) a` in there to select a different overload.
Got it! Thanks
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply