Convert array to custom type when passing function argument

Stefanos Baziotis sdi1600105 at di.uoa.gr
Thu Apr 18 00:21:11 UTC 2019


On Wednesday, 17 April 2019 at 23:44:42 UTC, Adam D. Ruppe wrote:
>
> 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
> };

Yes, thanks. :)

Actually, I asked initially because in C++ you can do the thing I 
described.
I thought that you meant something I missed with out-out.

- Stefanos




More information about the Digitalmars-d-learn mailing list