On Tuesday, 28 January 2020 at 08:54:16 UTC, Simen Kjærås wrote:
import std.stdio : writefln;
import std.format : format;
import std.algorithm : map;
auto vec = [1000, 2000, 3000];
writefln("%-(%s\t%)", vec.map!(e => format!"%,2?d"('_',
e)));
That helps, thank you very
I want to format an array using the %(...%) syntax. How can I
change the separator? I tried to use ? and add it as additional
parameter, but that doesn't seem to work on arrays:
import std;
void main()
{
writeln("This works:");
writefln("%,2?d", '_', 2000); // 20_00
auto vec =
On Wednesday, 11 July 2018 at 10:07:33 UTC, Timoses wrote:
On Wednesday, 11 July 2018 at 08:31:30 UTC, Dorian Haglund
wrote:
[...]
As the error message says taskPool.reduce is a non-global
template. It's embedded in a taskPool struct. I can't say what
the reason is that a delegate cannot be
I want to import a config file at compile time, but also need a
way to have multiple configurations.
With gcc you could do something like
-DIMPORTFROM='"MyConfigFile.txt"'. Is there any equivalent in D?
Hardcoding the config files for different versions and using that
is not an option.
On Saturday, 2 June 2018 at 23:12:46 UTC, DigitalDesigns wrote:
On Thursday, 7 September 2017 at 22:53:31 UTC, Biotronic wrote:
[...]
I use something similar where I use structs behaving like
enums. Each field in the struct is an "enum value" which an
attribute, this is because I have not
On Wednesday, 30 May 2018 at 21:27:44 UTC, Ali Çehreli wrote:
On 05/30/2018 02:19 PM, Malte wrote:
Why does this code complain at the last line about a missing
[] operator overload?
auto buffer = new char[6];
auto chunked = buffer.chunks(3);
chunked[1][2] = '!';
Same happens with wchar.
Why does this code complain at the last line about a missing []
operator overload?
auto buffer = new char[6];
auto chunked = buffer.chunks(3);
chunked[1][2] = '!';
Same happens with wchar.
Dchar and byte work as expected.
On Sunday, 27 May 2018 at 06:47:38 UTC, IntegratedDimensions
wrote:
A string mixin is too messy since it treats the code as a
string losing all syntax highlighting, etc.
I'd love to have something like a template mixin where I can
just do
mixin template fooSetup(ret)
{
// setup stuff
On Saturday, 26 May 2018 at 18:10:30 UTC, Neia Neutuladh wrote:
On Saturday, 26 May 2018 at 15:00:40 UTC, Malte wrote:
This compiles with DMD, however it returns random numbers
instead of the value I passed in. Looks like a bug to me.
Should that work or is there any other pattern I could use
I was trying to get a function that has a closure allocation to
compile with @nogc.
Assuming this function:
int identity(immutable int q) pure nothrow @safe
{
import std.algorithm;
static immutable auto arr = [42];
int getSecondArgument(int a, int b)
{
return b;
}
On Wednesday, 23 May 2018 at 13:36:20 UTC, rikki cattermole wrote:
On 24/05/2018 1:29 AM, Malte wrote:
On Wednesday, 23 May 2018 at 13:24:35 UTC, rikki cattermole
wrote:
On 24/05/2018 1:20 AM, Malte wrote:
On Tuesday, 22 May 2018 at 21:45:07 UTC,
IntegratedDimensions wrote:
an idea to lock
On Wednesday, 23 May 2018 at 13:24:35 UTC, rikki cattermole wrote:
On 24/05/2018 1:20 AM, Malte wrote:
On Tuesday, 22 May 2018 at 21:45:07 UTC, IntegratedDimensions
wrote:
an idea to lock data by removing the reference:
class A
{
Lockable!Data data;
}
[...]
This sounds like you are
On Tuesday, 22 May 2018 at 21:45:07 UTC, IntegratedDimensions
wrote:
an idea to lock data by removing the reference:
class A
{
Lockable!Data data;
}
[...]
This sounds like you are looking for is an atomic swap. Afaik it
doesn't exist in the standard library. You could use asm for the
On Monday, 21 May 2018 at 19:44:17 UTC, Jonathan M Davis wrote:
Walter wants to use assertions to then have the compiler make
assumptions about the code and optimized based on it, but he
hasn't implemented anything like that, and there are a number
of arguments about why it's a very bad idea -
On Wednesday, 23 May 2018 at 02:24:08 UTC, IntegratedDimensions
wrote:
In some cases the decision holds for continuous ranges. For
some 0 <= n <= N the decision is constant, but n is
arbitrary(determined by unknown factors at compile time).
One can speed up the routine by using something akin
I was interested by asserts and how the compiler uses them to
optimize the code. So I looked at the compiler explorer to see
how and found it, it doesn't.
What I tried to do is turn a std.conv.to!ulong(byte) to a simple
cast with the help of assertions.
https://godbolt.org/g/4uckWU
If there
16 matches
Mail list logo