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
inout(string[string]
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?
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
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
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;
> >
> >
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;
> >
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
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
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] to
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: cannot
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]
21 matches
Mail list logo