On 10/21/2015 11:14 PM, DarkRiDDeR wrote:
Hello. I have a class:
abstract class Addon
{
public activate(){...}
...
}
its children:
class A: Addon {... }
class B: Addon {... }
How do I create an array of subclasses Addon? For example, one could to
do so:
T[2] addons = [new A(), new
Hello. I have a class:
abstract class Addon
{
public activate(){...}
...
}
its children:
class A: Addon {... }
class B: Addon {... }
How do I create an array of subclasses Addon? For example, one
could to do so:
T[2] addons = [new A(), new B()];
foreach(T addon; addons){
On Wednesday, 21 October 2015 at 19:49:35 UTC, Ali Çehreli wrote:
On 10/21/2015 12:37 PM, Sigg wrote:
> cause at least few more "fun" side effects.
One of those side effects would be function calls binding
silently to another overload:
void foo(bool){/* ... */}
void foo(int) {/* ... */}
a
On Wednesday, 21 October 2015 at 22:49:16 UTC, Marco Leise wrote:
Am Wed, 21 Oct 2015 12:49:35 -0700
schrieb Ali Çehreli :
On 10/21/2015 12:37 PM, Sigg wrote:
> cause at least few more "fun" side effects.
One of those side effects would be function calls binding
silently to another overload
On Thursday, 22 October 2015 at 04:25:01 UTC, MobPassenger wrote:
On Thursday, 22 October 2015 at 04:01:16 UTC, Mike Parker wrote:
On Thursday, 22 October 2015 at 03:19:49 UTC, MobPassenger
wrote:
code:
---
struct Foo
{
bool opIn_r(T)(T t){return false;}
}
This needs to be marked with co
On Thursday, 22 October 2015 at 03:21:35 UTC, MobPassenger wrote:
On Thursday, 22 October 2015 at 03:18:25 UTC, MobPassenger
wrote:
code:
Plz don't reply, there's been a forum bug while posting.
What forum bug would that be?
On Thursday, 22 October 2015 at 04:01:16 UTC, Mike Parker wrote:
On Thursday, 22 October 2015 at 03:19:49 UTC, MobPassenger
wrote:
code:
---
struct Foo
{
bool opIn_r(T)(T t){return false;}
}
This needs to be marked with const:
struct Foo
{
bool opIn_r(T)(T t) const {return false;}
}
anonymous wrote:
> Huh. I can't find any specification on this, but apparently the local
> overload set shadows any imported overload sets completely.
Should I file a bug on this then?
--
Shriramana Sharma, Penguin #395953
On Thursday, 22 October 2015 at 03:19:49 UTC, MobPassenger wrote:
code:
---
struct Foo
{
bool opIn_r(T)(T t){return false;}
}
This needs to be marked with const:
struct Foo
{
bool opIn_r(T)(T t) const {return false;}
}
On Thursday, 22 October 2015 at 03:18:25 UTC, MobPassenger wrote:
code:
Plz don't reply, there's been a forum bug while posting. Full
post is here:
http://forum.dlang.org/thread/kaqyeiakjunqoexos...@forum.dlang.org
code:
---
struct Foo
{
bool opIn_r(T)(T t){return false;}
}
static immutable Foo foo; // ouch
//static Foo foo; // OK
void main()
{
assert("a" !in foo);
}
code:
---
struct Foo
{
bool opIn_r(T)(T t){return false;}
}
static immutable Foo foo; // ouch
//static Foo foo; // OK
void main()
{
assert("a" !in foo);
}
---
output:
---
Error: template Foo.opIn_r cannot deduce function from argument
types !()(string) immutable, candidates are:
runna
To me this looks like a library error, but I'm not sure. Any suggestions
importstd.uni;
chargcCat1(dchar ch)
{ if(ch in unicode.L)return'L';//Letter
if(ch in unicode.M)return'M';//Mask
if(ch in unicode.C)ret
Am Wed, 21 Oct 2015 12:49:35 -0700
schrieb Ali Çehreli :
> On 10/21/2015 12:37 PM, Sigg wrote:
>
> > cause at least few more "fun" side effects.
>
> One of those side effects would be function calls binding silently to
> another overload:
>
> void foo(bool){/* ... */}
> void foo(int) {/* ...
On Wednesday, October 21, 2015 08:28 PM, Shriramana Sharma wrote:
> Kagamin wrote:
>
>> http://dlang.org/hijack.html
>
> Thanks people, but even as per the rules:
>
> 1. Perform overload resolution independently on each overload set
> 2. If there is no match in any overload set, then error
> 3.
On 10/21/2015 12:37 PM, Sigg wrote:
> cause at least few more "fun" side effects.
One of those side effects would be function calls binding silently to
another overload:
void foo(bool){/* ... */}
void foo(int) {/* ... */}
auto a = 0; // If the type were deduced by the value,
foo(a);
On Wednesday, 21 October 2015 at 19:07:24 UTC, anonymous wrote:
The problem is of course that int and ulong have no common
super type, at least not in the primitive integer types. int
supports negative values, ulong supports values greater than
long.max.
Yes, I'm well aware of that. I was un
On Wednesday, October 21, 2015 07:53 PM, Sigg wrote:
> void func() {
> int a = -10;
> ulong b = 0;
> ulong c = a + b;
> writefln("%s", c);
> }
>
> out: 18446744073709551574
>
> But shouldn't declaring c as auto force compiler to go extra step
>
On Wednesday, 21 October 2015 at 18:50:08 UTC, Adam D. Ruppe
wrote:
Use the .exe installer and it will offer to download and
install visual studio for you as part for its process.
I don't know if that feature has made it into a release yet. I
don't think Vc2015 is supported yet either in a rel
Use the .exe installer and it will offer to download and install
visual studio for you as part for its process.
How to install DMD 64bit on Windows? Is it just a case of
downloading from here and it just works?
http://dlang.org/download.html
Or do I need Visual Studio installed?
Kagamin wrote:
> http://dlang.org/hijack.html
Thanks people, but even as per the rules:
1. Perform overload resolution independently on each overload set
2. If there is no match in any overload set, then error
3. If there is a match in exactly one overload set, then go with that
4. If there is a
I started reading "The D programming Language" earlier, and came
to the "2.3.3 Typing of Numeric Operators" section which claims
that "if at least one participant has type ulong, the other is
implicitly converted to ulong prior to the application and the
result has type ulong.".
Now I underst
On 10/20/2015 10:38 AM, Charles Hixson via Digitalmars-d-learn wrote:
In std.uni (D Lib 2.068.2) I can no longer see how to get the general
category code for a character. Does anyone know what the currently
supported way to do that is?
I thought I remembered that I used to be able to direct
On Wednesday, October 21, 2015 14:11:20 anonymous via Digitalmars-d-learn wrote:
> On Wednesday, 21 October 2015 at 14:06:54 UTC, Shriramana Sharma
> wrote:
> > import std.stdio, std.range;
> > void mywrite(char [5] chars, real[5] vals)
> > {
> > static string [5] fmts = ["%9.4f, ", "%9.4f; ",
std.string.toStringz – why the strange name with z instead of toString0 or
toCString?
--
Shriramana Sharma, Penguin #395953
On Wednesday, 21 October 2015 at 14:27:52 UTC, Shriramana Sharma
wrote:
std.string.toStringz – why the strange name with z instead of
toString0 or toCString?
`stringz` is a traditional name for a Zero terminated string.
On Wednesday, 21 October 2015 at 14:06:54 UTC, Shriramana Sharma
wrote:
import std.stdio, std.range;
void mywrite(char [5] chars, real[5] vals)
{
static string [5] fmts = ["%9.4f, ", "%9.4f; ", "%3d, ",
"%3d, ",
"%3d\n"];
foreach (e; zip(chars, fmts, vals)) write(e[0], " = ",
e[1].forma
import std.stdio, std.range;
void mywrite(char [5] chars, real[5] vals)
{
static string [5] fmts = ["%9.4f, ", "%9.4f; ", "%3d, ", "%3d, ",
"%3d\n"];
foreach (e; zip(chars, fmts, vals)) write(e[0], " = ",
e[1].format(e[2]));
}
Compiling gives:
zip_string.d(5): Error: template std.range.
On Wednesday, October 21, 2015 02:05 PM, Shriramana Sharma wrote:
> When I've imported std.math which contains round(real), why is the
> compiler complaining about not being able to call the overload function
> defined in *this* module?
The functions don't form an overload set. You need to bring
On Wednesday, 21 October 2015 at 12:05:27 UTC, Shriramana Sharma
wrote:
import std.math;
real round(real val, int prec)
{
real pow = 10 ^^ prec;
return round(val * pow) / pow;
}
Trying to compile this I get:
foo.d(5): Error: function foo.round (real val, int prec) is not
callable using
http://dlang.org/hijack.html
import std.math;
real round(real val, int prec)
{
real pow = 10 ^^ prec;
return round(val * pow) / pow;
}
Trying to compile this I get:
foo.d(5): Error: function foo.round (real val, int prec) is not callable
using argument types (real)
When I've imported std.math which contains round(r
On Tuesday, 20 October 2015 at 16:53:19 UTC, holo wrote:
When im checking instance name with such code:
auto test =
list.parseXPath(`//tagSet/item[key="Name"]/value`)[0].goCData;
it is compiling properly but it is breaking program when is no
name set.
I make quick workaround:
auto
On Tuesday, 20 October 2015 at 18:08:33 UTC, Ali Çehreli wrote:
On 10/20/2015 08:48 AM, Andrea Fontana wrote:
It happens I need to perform an operation just one time
(inside a
function, a loop...)
An idea that uses a function pointer where the first step does
its task and then sets the stage
35 matches
Mail list logo