How are extra copy constructor parameters used?
Ali Çehreli
acehreli at yahoo.com
Thu Dec 30 01:04:10 UTC 2021
The second item in the documentation mentions "any number of default
parameters" when describing copy constructor syntax:
https://dlang.org/spec/struct.html#struct-copy-constructor
1) I can't figure out how to use those extra parameters. For example, I
can't find a special function name to call explicitly:
S.__cctor(a, 42); // No go
2) Unlike the examples there, I think the parameter should most usefully
be defined as 'const' unless there is a special reason:
struct S {
// const(S) instead of S:
this(ref const(S) that) {
}
}
Do you agree?
Thank you,
Ali
More information about the Digitalmars-d-learn
mailing list