On Saturday, 15 June 2019 at 17:42:04 UTC, ag0aep6g wrote:
On Saturday, 15 June 2019 at 17:24:45 UTC, user1234 wrote:
---
void foo(){writeln(__PRETTY_FUNCTION__);}
void main(string[] args)
{
void delegate() dg;
dg.funcptr = &foo;
dg.ptr = null; // usually a "this" or a frame address
On Saturday, 15 June 2019 at 17:24:45 UTC, user1234 wrote:
---
void foo(){writeln(__PRETTY_FUNCTION__);}
void main(string[] args)
{
void delegate() dg;
dg.funcptr = &foo;
dg.ptr = null; // usually a "this" or a frame address
dg();
}
---
because dg.ptr would be used to retrieve t
On Saturday, 15 June 2019 at 16:34:22 UTC, Robert M. Münch wrote:
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be
mixed. But the standard function std.functional.toDelegate
converts a function to a delegate."
Your example compiles i
On Saturday, 15 June 2019 at 16:34:22 UTC, Robert M. Münch wrote:
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be
mixed. But the standard function std.functional.toDelegate
converts a function to a delegate."
Your example compiles i
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be mixed. But
the standard function std.functional.toDelegate converts a function to
a delegate."
Your example compiles if the assignment is changed to dg =
toDelegate(&myFunc); (given ap
On Saturday, 15 June 2019 at 15:54:00 UTC, Robert M. Münch wrote:
Why does the follwing code give: Error: cannot implicitly
convert expression & myFunc of type void function(int a) to
void delegate(int)
void myFunc(int a){return;}
void main()
{
void delegate(int) dg;
dg = &am
Why does the follwing code give: Error: cannot implicitly convert
expression & myFunc of type void function(int a) to void delegate(int)
void myFunc(int a){return;}
void main()
{
void delegate(int) dg;
dg = &myFunc;
}
See: https://run.dlang.io/is/iTYo2L
--
Robert M. Mü
On Thursday, 15 March 2018 at 15:41:54 UTC, Robert-D wrote:
Why something like this doesn't compile (with or without the
cast on bb.dup)?
struct S {
string[string] aa;
S dup() inout pure {
return S(cast(string[string]) aa.dup);
}
}
struct SS {
S[] bb;
SS dup() ino
On Thursday, 15 March 2018 at 13:18:38 UTC, Simen Kjærås wrote:
On Thursday, 15 March 2018 at 12:00:08 UTC, Robert-D wrote:
I want the function to create a mutable copy from a const or a
imutable
Like this:
void main() {
const S s = S(["": ""]);
S b = s.dup();
}
How can i do that?
On Thursday, 15 March 2018 at 12:00:08 UTC, Robert-D wrote:
I want the function to create a mutable copy from a const or a
imutable
Like this:
void main() {
const S s = S(["": ""]);
S b = s.dup();
}
How can i do that?
In that case, the problem is that you also have to .dup the aa:
On Thursday, 15 March 2018 at 11:33:49 UTC, Simen Kjærås wrote:
On Thursday, 15 March 2018 at 11:18:48 UTC, Robert-D wrote:
[...]
This is where things go wrong:
[...]
'inout' means that this function can keep the const, immutable
or mutable status of the type on which the function is
On Thursday, 15 March 2018 at 11:18:48 UTC, Robert-D wrote:
struct S {
string[string] aa;
S dup() inout pure {
return S(aa);
}
}
void main() {
auto s = S(["": ""]);
s.dup();
}
Result:
Error: cannot implicitly convert expression this.aa of type
struct S {
string[string] aa;
S dup() inout pure {
return S(aa);
}
}
void main() {
auto s = S(["": ""]);
s.dup();
}
Result:
Error: cannot implicitly convert expression this.aa of type
inout(string[string]) to string[string]
I need help with the above program.
On Thursday, 23 October 2014 at 19:18:33 UTC, Suliman wrote:
Solution
http://forum.dlang.org/thread/bgkklxwbhrqdhveth...@forum.dlang.org#post-l639dt:24vlj:241:40digitalmars.com
Am I right understand that it's bug in doc?
It certainly looks like one. std.net.curl's documentation
examples aren
Solution
http://forum.dlang.org/thread/bgkklxwbhrqdhveth...@forum.dlang.org#post-l639dt:24vlj:241:40digitalmars.com
Am I right understand that it's bug in doc?
import std.stdio;
import std.conv;
import std.string;
import std.net.curl;
void main()
{
string content = get("d-lang.appspot.com/testUrl2");
}
Error: cannot implicitly convert expression (get("d-lang.appsp
ot.com/testUrl2", AutoProtocol())) of type char[] to stri
On Wed, Dec 11, 2013 at 7:26 AM, Dfr wrote:
>
> Thank you, this clears thing to me.
>
> I currently has all stuff wrapped in Variants because it is structure parsed
> from xml (or json), and it could be for example map of Something[string],
> where Something could be string or array or another map
Thank you, this clears thing to me.
I currently has all stuff wrapped in Variants because it is
structure parsed from xml (or json), and it could be for example
map of Something[string], where Something could be string or
array or another map, and also this all nested few levels deep.
I'm ne
> void main()
> {
> Variant[] lols = [ Variant(["hello": Variant(1)]), Variant(["bye":
> Variant(true)]) ];
> auto vtypes = map!(to!Variant[string])(lols); // <--- line 11
>
> string[] filetypes = map!(to!string)(vtypes).array();
> writeln(filetypes);
> }
>
> Gives me:
> main.d(11)
Dfr:
auto vtypes = map!(to!Variant[string])(lols);
The short template instantiation syntax only supports a single
token, to avoid mistakes,so you need to add ():
map!(to!(Variant[string]))(lols);
That is better written:
lols.map!(to!(Variant[string]));
But I don't know if this is eno
Sigaud
wrote:
On Tue, Dec 10, 2013 at 6:54 AM, Dfr wrote:
Hello, here is example code, which doesn't work:
Variant[] vtypes = [ Variant("hello"), Variant("bye") ];
string[] filetypes = map!(to!string)(vtypes);
Gives me error:
Error: cannot implicitly convert
On Tue, Dec 10, 2013 at 6:54 AM, Dfr wrote:
> Hello, here is example code, which doesn't work:
>
> Variant[] vtypes = [ Variant("hello"), Variant("bye") ];
> string[] filetypes = map!(to!string)(vtypes);
>
> Gives me error:
>
> Error: cann
Hello, here is example code, which doesn't work:
Variant[] vtypes = [ Variant("hello"), Variant("bye") ];
string[] filetypes = map!(to!string)(vtypes);
Gives me error:
Error: cannot implicitly convert expression (map(vtypes)) of type
MapResult!(to, Va
n handler_;
}
}
---
class PlayerLoginEvent : Event!(PlayerLoginEvent) {
int x;
}
src\Event\Event.d(41): Error: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(PlayerLoginEvent).HandlerList
src\Event\Event.d(51): Error: cannot implicit
LoginEvent) {
int x;
}
src\Event\Event.d(41): Error: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(PlayerLoginEvent).HandlerList
src\Event\Event.d(51): Error: cannot implicitly convert
expression (handler_) of type shared(Handl
or: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(PlayerLoginEvent).HandlerList
src\Event\Event.d(51): Error: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(Player
On Monday, September 20, 2010 04:11:05 Steven Schveighoffer wrote:
> You don't want a deep copy of a range. All you want to copy is the
> iteration state, not the data.
>
> save is definitely supposed to be shallow. I.e. you should copy the range
> itself, not what the range points to.
That mak
On Sat, 18 Sep 2010 17:20:31 -0400, Jonathan M Davis
wrote:
On Saturday 18 September 2010 09:58:15 Steven Schveighoffer wrote:
In reality, you cannot make save const, unless you want to do a deep
copy
(but I recommend against that, save should be a quick operation).
Well, I was trying
On Saturday 18 September 2010 06:45:51 Ivo Kasiuk wrote:
> Am Samstag, den 18.09.2010, 02:15 -0700 schrieb Jonathan M Davis:
> > Okay, if I try and compile the following program.
> >
> > struct S
> > {
> >
> > @property S save() const
> > {
> >
> > return this;
> >
> >
st
> > {
> >
> > return this;
> >
> > }
> >
> > int[] _val;
> >
> > }
> >
> > void main()
> > {
> > }
> >
> >
> > I get the error message
> >
> > d.d(5): E
On Sat, 18 Sep 2010 05:15:38 -0400, Jonathan M Davis
wrote:
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
I get the error message
d.d(5): Error: cannot implicitly convert
Am Samstag, den 18.09.2010, 02:15 -0700 schrieb Jonathan M Davis:
> Okay, if I try and compile the following program.
>
> struct S
> {
> @property S save() const
> {
> return this;
> }
>
> int[] _val;
> }
>
> void main()
> {
> }
>
Actually, wouldn't it be much more simp
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
I get the error message
d.d(5): Error: cannot implicitly convert expression (this) of type const(S) to S
If I remove const from save
Thanks for the help, folks.
CHICKZ
On Fri, 18 Jun 2010 08:41:17 -0700, Justin Spahr-Summers
wrote:
>
> On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea
> wrote:
> > Those are the result of code that I pulled directly from the D v1 docs from
> >
> > http://www.digitalmars.com/d/1.0/arrays.html
> >
> > Specifically, the code
Stewart Gordon wrote:
Chick Corea wrote:
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u
On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea
wrote:
> Those are the result of code that I pulled directly from the D v1 docs from
>
> http://www.digitalmars.com/d/1.0/arrays.html
>
> Specifically, the code is this.
>
> int* p;
> int[3] s;
> int[] a;
> p =
Chick Corea wrote:
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u] to int*
Error
On 06/18/2010 12:25 AM, Chick Corea wrote:
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u] to int*
Error: cannot implicitly convert
40 matches
Mail list logo