On Saturday, June 1, 2019 8:23:58 PM MDT David Zhang via Digitalmars-d-learn
wrote:
> On Saturday, 1 June 2019 at 16:30:12 UTC, Jonathan M Davis wrote:
> > If any member variable of a struct is const, then you can't
> > modify that member ever, and assignment isn't possible unless
> > you override
On Sunday, 2 June 2019 at 04:02:08 UTC, Paul Backus wrote:
On Saturday, 1 June 2019 at 23:29:08 UTC, SrMordred wrote:
On Saturday, 1 June 2019 at 21:39:33 UTC, SImen Kjærås wrote:
On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote:
Haven't tested it extensively, so use at your own risk
On Saturday, 1 June 2019 at 23:29:08 UTC, SrMordred wrote:
On Saturday, 1 June 2019 at 21:39:33 UTC, SImen Kjærås wrote:
On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote:
hasElaborateCopyConstructor checks if the type defines a
postblit[0].
Yes, I know this.
But since dmd 2.086 we
On Saturday, 1 June 2019 at 13:00:50 UTC, ag0aep6g wrote:
How is setting/replacing different from modifying?
e.g.:
S s;
this() { s = ...; }
update(S s) { this.s = s; }
mod(int i) { s.i = i; } // illegal
Kinda like how strings can be copied and assigned to, but not
modifie
On Saturday, 1 June 2019 at 16:30:12 UTC, Jonathan M Davis wrote:
If any member variable of a struct is const, then you can't
modify that member ever, and assignment isn't possible unless
you override opAssign so that it overwrites only the mutable
members. It's very rare that it makes sense to
On Saturday, 1 June 2019 at 21:39:33 UTC, SImen Kjærås wrote:
On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote:
hasElaborateCopyConstructor checks if the type defines a
postblit[0].
Yes, I know this.
But since dmd 2.086 we have copy ctors:
https://dlang.org/changelog/2.086.0.html#c
On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote:
import std.traits;
struct T { this(ref return scope T other){} }
pragma(msg, hasElaborateCopyConstructor!T); //false
hasElaborateCopyConstructor checks if the type defines a
postblit[0]. That is, a function called this(this). this(T)
import std.traits;
struct T { this(ref return scope T other){} }
pragma(msg, hasElaborateCopyConstructor!T); //false
On Saturday, 1 June 2019 at 19:10:36 UTC, Paul Backus wrote:
On Saturday, 1 June 2019 at 02:27:36 UTC, SrMordred wrote:
void main() {
T a;
T b;
a.__ctor(b);
}
https://run.dlang.io/is/NeioBs
Thanks!
The most obvious way i didn´t think :P
On Saturday, 1 June 2019 at 02:27:36 UTC, SrMordred wrote:
Its possible to call copyctor manually without calling dtor?
ex, what i did before:
struct T{ ~this(){ writeln("DTOR"); } this(this){
writeln("POSTBLIT"); } }
T a;
T b;
memcpy(&a,&b,T.sizeof);
a.__postblit;
/*
output:
POSTBLIT
DTOR
On Saturday, 1 June 2019 at 14:24:11 UTC, Robert M. Münch wrote:
The myFilter struct is the implementation which myClass.put()
should use to iterate over all objects.
Which ones? The E-objects, or the objects contained in myClass,
which you don't want to know about?
All things being only
Hi Guys!
In my programm, I have a custom String-type that I want to
initialize some variables of at compile time by casting a string
literal to said custom String type. I thought I could achieve
this straight forwardly, but after trying a bit, I could not find
a (simple) working solution. I m
On Saturday, June 1, 2019 6:51:08 AM MDT David Zhang via Digitalmars-d-learn
wrote:
> Say I have a struct `S`:
>
> struct S {
> /*const*/ char* pointer;
> ... other members ...
>
> this(/*const*/ char* p, ... others ...) {
> pointer = p;
>
On 2019-06-01 04:43:13 +, Alex said:
That's ok, but could you provide an example anyway? Is it like this?
´´´
void main(){
auto target = new myClass!int();
target.objects.length = 4;
auto val = 42;
put(target, val, testfunction); // does the test function enters here?
On 01.06.19 14:51, David Zhang wrote:
struct S {
/*const*/ char* pointer;
... other members ...
this(/*const*/ char* p, ... others ...) {
pointer = p;
...
}
}
What I want, is to be able to use `S` in other data structures w
01.06.2019 15:55, drug пишет:
Is there a type-safe way to do this? If this were a class, I'd try
std.typecons.Rebindable.
Ah, sorry))
01.06.2019 15:51, David Zhang пишет:
Say I have a struct `S`:
struct S {
/*const*/ char* pointer;
... other members ...
this(/*const*/ char* p, ... others ...) {
pointer = p;
...
}
}
What I want, is to be able to use `S` i
Say I have a struct `S`:
struct S {
/*const*/ char* pointer;
... other members ...
this(/*const*/ char* p, ... others ...) {
pointer = p;
...
}
}
What I want, is to be able to use `S` in other data structures
with the following pr
On 2019-05-30 18:29:44 +, Steven Schveighoffer said:
You can dub add-local your local fork, and it will use that instead of
going out to code.dlang.org.
Ok, any chance to switch back and forth between local/remote versions?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | fa
On Friday, 31 May 2019 at 08:35:23 UTC, Simen Kjærås wrote:
With 1), 2) and 3) fixed, the code would look like this (only
changed code included):
unittest {
with (Dispatcher.X) {
A(1);
A("a");
B(2);
C_Q(3);
}
}
struct Dispatcher {
struct opDispatch(s
On Fri, 2019-05-31 at 18:47 +, Obsidian Jackal via Digitalmars-d-
learn wrote:
> I'm new to D and want to create GTK+ apps. I have Visual Studio,
> Glade, the Gtk+ runtime, DMD, and DUB installed. What steps,
> guides, or advice should I follow to be able to be able to use
> these tools toge
On Friday, May 31, 2019 9:59:13 PM MDT Yatheendra via Digitalmars-d-learn
wrote:
> Hi people.
>
> The 'version' keyword sounds like a fantastic capability, but how
> far does DMD take it (and does GDC take it equally far)? This is
> not a "D Improvement Proposal", I am just asking how it is now.
>
22 matches
Mail list logo