On Sunday, 15 April 2018 at 17:59:01 UTC, Dgame wrote:
How am I supposed to insert a struct with immutable members
into an assoc. array?
Reduced example:
struct A {
immutable string name;
}
A[string] as;
as["a"] = A("a"); // Does not work
Via a static this() it would work. But
How am I supposed to insert a struct with immutable members into
an assoc. array?
Reduced example:
struct A {
immutable string name;
}
A[string] as;
as["a"] = A("a"); // Does not work
On Sunday, 15 April 2018 at 16:55:36 UTC, bauss wrote:
On Sunday, 15 April 2018 at 15:55:15 UTC, ag0aep6g wrote:
On 04/15/2018 05:33 PM, bauss wrote:
On Sunday, 15 April 2018 at 10:27:26 UTC, ag0aep6g wrote:
On 04/14/2018 08:56 PM, bauss wrote:
I wish there was a way to give a mixin some kind
On Sunday, 15 April 2018 at 15:55:15 UTC, ag0aep6g wrote:
On 04/15/2018 05:33 PM, bauss wrote:
On Sunday, 15 April 2018 at 10:27:26 UTC, ag0aep6g wrote:
On 04/14/2018 08:56 PM, bauss wrote:
I wish there was a way to give a mixin some kind of identity
like:
mixin("mymixin", "somecode");
On 04/15/2018 05:33 PM, bauss wrote:
On Sunday, 15 April 2018 at 10:27:26 UTC, ag0aep6g wrote:
On 04/14/2018 08:56 PM, bauss wrote:
I wish there was a way to give a mixin some kind of identity like:
mixin("mymixin", "somecode");
Where an error message would print something like:
Error in
On Sunday, 15 April 2018 at 10:14:56 UTC, Simen Kjærås wrote:
On Saturday, 14 April 2018 at 08:20:51 UTC, bauss wrote:
The problem is I can't pragma(msg) the code I want to mixin
manually since all mixins are dynamically generated. That's
why my only way is to do it within that static foreach.
On 04/15/2018 02:04 PM, vladdeSV wrote:
foo(1,2,3);
void foo(T...)(T args)
{
writefln("expected: %s", [1,2,3]);
writefln("actual: %s", args);
}
The code above will output
expected: [1, 2, 3]
actual: 1
How would I go on about to print all the
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote:
How would I go on about to print all the arguments as I
expected it, using "%s"?
You can expand the template arguments into an array by putting it
into square brackets: [args]. You can format an array with the
default notation using
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote:
Hello people of D-land.
In a template function, I want to format all arguments as if it
was an array. Se this snippet of code:
foo(1,2,3);
void foo(T...)(T args)
{
writefln("expected: %s", [1,2,3]);
Hello people of D-land.
In a template function, I want to format all arguments as if it
was an array. Se this snippet of code:
foo(1,2,3);
void foo(T...)(T args)
{
writefln("expected: %s", [1,2,3]);
writefln("actual: %s", args);
}
The code above will output
On 04/14/2018 08:56 PM, bauss wrote:
I wish there was a way to give a mixin some kind of identity like:
mixin("mymixin", "somecode");
Where an error message would print something like:
Error in mixin("mymixin"): ...
That would completely solve this issue and I wouldn't have to have
On Saturday, 14 April 2018 at 08:20:51 UTC, bauss wrote:
The problem is I can't pragma(msg) the code I want to mixin
manually since all mixins are dynamically generated. That's why
my only way is to do it within that static foreach.
Wat.
So the compiler is able to generate the string you
On Sunday, April 15, 2018 07:59:17 Stefan Koch via Digitalmars-d-learn
wrote:
> On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote:
> > Hey,
> >
> > How/where to hack DMD to generate docs for string mixed members?
> >
> > struct S
> > {
> >
> > mixin("
> >
> > ///
> > auto bar() {}
On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote:
Hey,
How/where to hack DMD to generate docs for string mixed members?
struct S
{
mixin("
///
auto bar() {}
");
}
Best regards,
Ilya Yaroshenko
hmm you should be able to see docs for string mixins, if not.
try using
14 matches
Mail list logo