Convert array to custom type when passing function argument
Adam D. Ruppe
destructionator at gmail.com
Wed Apr 17 23:44:42 UTC 2019
On Wednesday, 17 April 2019 at 23:26:16 UTC, Stefanos Baziotis
wrote:
>> I argue C++'s mistake was *out-out* implicit construction
>
> What do you mean by out-out?
In C++, if you define a struct/class, and constructors apply for
this.
struct Test {
Test(const char* foo) {}
};
void cool(Test t) {}
cool("string"); // works
That works in C++, unless you mark that constructor with
`explicit`
struct Test {
explicit Test(const char* foo) {} // this opts out of the cool
thing above
};
More information about the Digitalmars-d-learn
mailing list