Re: Error: cannot implicitly convert expression this.aa of type inout(string[string]) to string[string]

2018-03-15 Thread Simen Kjærås via Digitalmars-d-learn
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

Re: Error: cannot implicitly convert expression this.aa of type inout(string[string]) to string[string]

2018-03-15 Thread Robert-D via Digitalmars-d-learn
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?

Re: Error: cannot implicitly convert expression this.aa of type inout(string[string]) to string[string]

2018-03-15 Thread Simen Kjærås via Digitalmars-d-learn
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:

Re: Error: cannot implicitly convert expression this.aa of type inout(string[string]) to string[string]

2018-03-15 Thread Robert-D via Digitalmars-d-learn
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

Re: Error: cannot implicitly convert expression this.aa of type inout(string[string]) to string[string]

2018-03-15 Thread Simen Kjærås via Digitalmars-d-learn
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 inout(string[string]

Re: Error: cannot implicitly convert expression

2014-10-23 Thread Jonathan M Davis via Digitalmars-d-learn
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

Re: Error: cannot implicitly convert expression

2014-10-23 Thread Suliman via Digitalmars-d-learn
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?

Re: Error: cannot implicitly convert expression

2013-06-18 Thread Agustin
On Tuesday, 18 June 2013 at 21:43:17 UTC, Agustin wrote: On Tuesday, 18 June 2013 at 21:39:35 UTC, Agustin wrote: Hello!, i'm having a problem and i don't know how to fix it :(. /** * Define a common structure for any event. * * @author Wolftein */ public class Event(T) { private bool

Re: Error: cannot implicitly convert expression

2013-06-18 Thread Agustin
On Tuesday, 18 June 2013 at 21:39:35 UTC, Agustin wrote: Hello!, i'm having a problem and i don't know how to fix it :(. /** * Define a common structure for any event. * * @author Wolftein */ public class Event(T) { private bool cancelled_; private shared static HandlerList

Re: Error: cannot implicitly convert expression (this) of type const(S) to S

2010-09-20 Thread Jonathan M Davis
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

Re: Error: cannot implicitly convert expression (this) of type const(S) to S

2010-09-20 Thread Steven Schveighoffer
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

Re: Error: cannot implicitly convert expression (this) of type const(S) to S

2010-09-18 Thread Jonathan M Davis
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; > > > >

Re: Error: cannot implicitly convert expression (this) of type const(S) to S

2010-09-18 Thread Jonathan M Davis
On Saturday 18 September 2010 09:58:15 Steven Schveighoffer wrote: > 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; > >

Re: Error: cannot implicitly convert expression (this) of type const(S) to S

2010-09-18 Thread Steven Schveighoffer
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 expre

Re: Error: cannot implicitly convert expression (this) of type const(S) to S

2010-09-18 Thread Ivo Kasiuk
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

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-21 Thread Chick Corea
Thanks for the help, folks. CHICKZ

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-18 Thread Justin Spahr-Summers
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

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-18 Thread Don
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] to

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-18 Thread Justin Spahr-Summers
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 =

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-18 Thread Stewart Gordon
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: cannot

Re: ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"

2010-06-17 Thread Ellery Newcomer
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]