As the topic says:
Is there an equivalent to C++'s explicit
keyword in D?
Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
August 19, 2021 D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
As the topic says: Is there an equivalent to C++'s |
August 19, 2021 Re: D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tejas | On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: >As the topic says: Is there an equivalent to C++'s No, because all constructors are explicit in D. |
August 19, 2021 Re: D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: >On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: >As the topic says: Is there an equivalent to C++'s No, because all constructors are explicit in D. Oh... then I guess I'll have to manually insert the explicit casts where C++ is doing implicit casts when calling constructors(God help me D: ) |
August 19, 2021 Re: D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tejas | On Thursday, 19 August 2021 at 18:04:58 UTC, Tejas wrote: >On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: >On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: >As the topic says: Is there an equivalent to C++'s No, because all constructors are explicit in D. Oh... then I guess I'll have to manually insert the explicit casts where C++ is doing implicit casts when calling constructors(God help me D: ) Worth noting that in the specific case of variable initialization, you do not have to write out the constructor call directly:
|
August 19, 2021 Re: D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | On Thursday, 19 August 2021 at 18:11:20 UTC, Paul Backus wrote: >On Thursday, 19 August 2021 at 18:04:58 UTC, Tejas wrote: >On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: >On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: >As the topic says: Is there an equivalent to C++'s No, because all constructors are explicit in D. Oh... then I guess I'll have to manually insert the explicit casts where C++ is doing implicit casts when calling constructors(God help me D: ) Worth noting that in the specific case of variable initialization, you do not have to write out the constructor call directly:
Yeah I know that
Gets rewritten as:
Thank you for your time! |
August 20, 2021 Re: D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tejas | On Thursday, 19 August 2021 at 18:04:58 UTC, Tejas wrote: >On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: >On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: >As the topic says: Is there an equivalent to C++'s No, because all constructors are explicit in D. Oh... then I guess I'll have to manually insert the explicit casts where C++ is doing implicit casts when calling constructors(God help me D: ) You don't have to, here is a binding generator with code conversion, even if it produces junk you can just copy paste relevant code. |
August 20, 2021 Re: D equivalent of C++ explicit | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | On Friday, 20 August 2021 at 05:43:49 UTC, evilrat wrote: >On Thursday, 19 August 2021 at 18:04:58 UTC, Tejas wrote: >On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: >On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: >As the topic says: Is there an equivalent to C++'s No, because all constructors are explicit in D. Oh... then I guess I'll have to manually insert the explicit casts where C++ is doing implicit casts when calling constructors(God help me D: ) You don't have to, here is a binding generator with code conversion, even if it produces junk you can just copy paste relevant code. Thank you! I've definitely been keeping an eye on your project since you mentioned it the last time. Good to know I can use it for this purpose :D |