On 04/17/2019 05:21 PM, Stefanos Baziotis wrote:
> On Wednesday, 17 April 2019 at 23:44:42 UTC, Adam D. Ruppe wrote:
>>explicit Test(const char* foo) {} // this opts out of the cool
>> thing above
> Actually, I asked initially because in C++ you can do the thing I
> described.
> I thought th
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
`ex
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
On Wednesday, 17 April 2019 at 16:33:17 UTC, Adam D. Ruppe wrote:
[...]
Thanks for the info!
I argue C++'s mistake was *out-out* implicit construction
What do you mean by out-out?
- Stefanos
On Wednesday, 17 April 2019 at 15:23:06 UTC, Stefanos Baziotis
wrote:
Sorry if this has been asked again, I didn't find anything.
Do we know the reason why it is not supported?
Basically implicit construction was considered a mistake in C++
and D didn't want to repeat that mistake. Most code g
On Wednesday, 17 April 2019 at 12:48:52 UTC, Adam D. Ruppe wrote:
This is the "implicit construction" I sometimes talk about
and D doesn't support it, by design (alas).
Sorry if this has been asked again, I didn't find anything.
Do we know the reason why it is not supported?
There's t
On Wednesday, 17 April 2019 at 12:20:49 UTC, Stefanos Baziotis
wrote:
I want to be able to make it work array-like to have compact
function calls.
Something like this:
test([1,2,3]);
This is the "implicit construction" I sometimes talk about
and D doesn't support it, by design (alas).
T
I have a custom Buf struct (working as a simple vector)
struct Buf(T) {
size_t cap, len;
T *data;
@nogc
this(T[] arr) {
reserve(arr.length);
foreach(item; arr) {
push(item);
}
}
...
};
And I have a function like this:
void test(Buf!(i