On Tuesday, 11 February 2014 at 03:50:16 UTC, Adam D. Ruppe wrote:
On Tuesday, 11 February 2014 at 03:45:30 UTC, Carl Sturtivant
wrote:
If I define a struct, and I want to pass a string to a
function with a parameter of type that very struct, is there
any way to arrange that an implicit conversion occurs,
assuming a function that maps a string to that struct type
exists?
Nope, you have to do it explicitly.
f(data("hello"));
[...]
I kinda wish D did have this. The mistake C++ made was having
the implicit conversions be the default, not having it be an
option. But it isn't in and as far as I know, there are no
plans to add it either.
Disappointing. It could be kept decoupled from constructors and
assignment defined conversions by having an analogue of opAssign
that's solely for argument passing.