On Tuesday, 14 November 2023 at 14:36:57 UTC, dhs wrote:
Just to clarify some more: isn't "s1 = ss1" similar to
I meant "ss1 = s1" here, sorry.
On Tuesday, 14 November 2023 at 08:50:34 UTC, dhs wrote:
I am using following code:
```d
struct S1
{
this(ref const S1 s) const { writeln("copy"); }
int i;
}
struct S2
{
this(ref inout S2 s) inout { writeln("copy"); }
int i;
}
void test()
{
const(S1) s1;
S1 ss1 = s1;
On Tuesday, 14 November 2023 at 13:43:03 UTC, Hipreme wrote:
Right now, I've been implementing classes separately, and I
need a dummy symbol. The best world is not even having a symbol
but having only its implementation, for example, I would like
being able to do that:
```d
void
On Tuesday, 14 November 2023 at 08:50:34 UTC, dhs wrote:
```d
struct S2
{
this(ref inout S2 s) inout { writeln("copy"); }
int i;
}
void test()
{
const(S1) s1;
S1 ss1 = s1; // error, ss1 not qualified as const
const(S2) s2;
S2 ss2 = s2; // fine, why?
}
```
Isn't "inout"
On Tuesday, 14 November 2023 at 13:41:32 UTC, Steven
Schveighoffer wrote:
```
Error: copy constructor `testinoutctor.S1.this(ref const(S1) s)
const` is not callable using argument types `(const(S1))`
```
I'm not sure what this means. There shouldn't be a copy being
made here, as the thing is
On Tuesday, 14 November 2023 at 13:58:17 UTC, Paul Backus wrote:
On Tuesday, 14 November 2023 at 13:41:32 UTC, Steven
The error is saying that the copy constructor expects a `const`
`this` argument, but you're passing a mutable `this` argument.
Thanks you both very much for answering.
On Tuesday, 14 November 2023 at 08:50:34 UTC, dhs wrote:
In other words: why doesn't ss2=s2 fail here?
Thanks,
dhs
Seems like it isn't called at all, your copy constructor with
inout. Could be a bug.
My assumption is that default copy constructors are generated
alongside inout one, and
On Monday, 13 November 2023 at 14:15:31 UTC, seany wrote:
Is there a better way? I want a method that works for every
variable type including classes and objects.
Thank you
Perhaps, use length property of string. It should tell you length
of a string and then you multiply it by size of
may be std.string.representation() may help?
https://dlang.org/phobos/std_string.html#.representation
byteSize = representation(myString).length;
Hello D experts,
I have a question regarding inout in struct copy constructors.
From the spec:
"The copy constructor can be overloaded with different qualifiers
applied to the parameter (copying from a qualified source) or to
the copy constructor itself (copying to a qualified destination)"
On Tuesday, 14 November 2023 at 09:07:24 UTC, Alexandru Ermicioi
wrote:
Seems like it isn't called at all, your copy constructor with
inout. Could be a bug.
My assumption is that default copy constructors are generated
alongside inout one, and then picked up for your initialization
instead
On Tuesday, 14 November 2023 at 14:36:57 UTC, dhs wrote:
Just to clarify some more: isn't "s1 = ss1" similar to
something like:
```d
const(S1) s1;
S1 ss1; // ss1 is now S1.init
S1_copy_construct_const_in_const_out(ss1, s1);
```
If this is the case, the compile error is expected,
On Tuesday, 14 November 2023 at 14:58:21 UTC, Paul Backus wrote:
```d
struct S2
{
int* p;
this(const int* p) const
{
// Ok - counts as initialization
this.p = p;
}
}
immutable int answer = 42;
void main()
{
S2 s2;
// If this were allowed to compile...
On Tuesday, 14 November 2023 at 13:58:17 UTC, Paul Backus wrote:
It's easier to see if you compare the actual and expected
argument lists side-by-side
Expected: (ref const(S1) s) const
Actual: (const(S1) )
^
Mismatched
On Tuesday, 14 November 2023 at 16:51:07 UTC, Paul Backus wrote:
There's no assignment. The value is constructed in-place, in
`ss2`'s memory.
The reason the compiler allows you to construct a `const(S2)`
value inside of an `S2` variable is that `const(S2)` implicitly
converts to `S2`.
On Saturday, 11 November 2023 at 23:28:18 UTC, Trevor wrote:
Thanks for the detailed reply. I guess what I'd like to do is
not create a DUB package for every little project I work on. It
seems like most modern languages require a package/dependency
manager though. Being able to install
On Tuesday, 14 November 2023 at 21:31:39 UTC, mw wrote:
handle SIGUSR1 noprint
handle SIGUSR2 noprint
These are what the GC used to use to stop/start threads.
received signal SIG34, Real-time event 34.
received signal SIG35, Real-time event 35.
And this is what it uses now.
druntime just
On Saturday, 11 November 2023 at 17:29:14 UTC, BoQsc wrote:
https://dlang.org/library/std/process.html
How do I pipe (|) through three programs using std.process?
https://dev.to/jessekphillips/piping-process-output-1cai
Your issue with [Find, "Hello"] might be
[Find, "\"Hello\""]
But I'm
Hi,
I have this in ~/.gdbinit already:
```
handle SIGUSR1 SIGUSR2 nostop
handle SIGUSR1 noprint
handle SIGUSR2 noprint
```
Today I encountered:
received signal SIG34, Real-time event 34.
then I added to ~/.gdbinit
```
handle SIG34 nostop noprint pass noignore
```
Next, I got:
received
19 matches
Mail list logo