On 31/01/2020 09:45, bauss wrote:
> On Friday, 31 January 2020 at 07:20:17 UTC, cc wrote:
>> char[4096] buf;
>> writeln(GC.stats.usedSize);
>> foreach (i; 0 .. 10) {
>> sformat(buf, "%f", 1.234f);
>> writeln(GC.stats.usedSize);
>> }
>>
>> Output with DMD32 D Compi
On Friday, 7 February 2020 at 22:03:00 UTC, H. S. Teoh wrote:
On Fri, Feb 07, 2020 at 07:37:08PM +, mark via
Digitalmars-d-learn wrote:
[snip]
bool[E] works just fine.
[snip]
Or you can wrap void[0][E] in a nice user-defined type that
gives nice set-like syntax. But IMO, this is all over
On 08.02.20 02:38, ag0aep6g wrote:
Simplified, we're looking at this:
struct Joiner
{
int[3] _items;
int[] _current;
}
void main() @safe
{
Joiner j;
j._current = j._items[];
}
I.e., a self-referential struct. Or most fundamentally:
struct Joiner
{
Joiner
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote:
Hi guys,
I am total newbie and trying to learn a little bit of
programming for personal purposes (web scrapping, small
databases for personal use etc.). I've been trying to install
any of IDE available, but had no success.
I use Manj
On 08.02.20 01:17, Steven Schveighoffer wrote:
The original code is not invalid though. f is not valid, and that is a
bug, but the original code posted by nullptr should be fine by memory
safety standards.
Maybe. But then it should also work with `int[3] front;`.
If there is no possible way t
On 2/7/20 6:30 PM, ag0aep6g wrote:
On 08.02.20 00:10, nullptr wrote:
```
import std;
struct SomeRange
{
int[3] val;
enum empty = false;
auto popFront() @safe {}
ref auto front() @safe
{
return val;
}
}
void main() @safe
{
SomeRange().take(10).map!
On 2/7/20 6:10 PM, nullptr wrote:
```
import std;
struct SomeRange
{
int[3] val;
enum empty = false;
auto popFront() @safe {}
ref auto front() @safe
{
return val;
}
}
void main() @safe
{
SomeRange().take(10).map!((return ref x) => x[]).joiner.writ
On 08.02.20 00:10, nullptr wrote:
```
import std;
struct SomeRange
{
int[3] val;
enum empty = false;
auto popFront() @safe {}
ref auto front() @safe
{
return val;
}
}
void main() @safe
{
SomeRange().take(10).map!((return ref x) => x[]).joiner.write
On Friday, 7 February 2020 at 22:55:29 UTC, Dennis wrote:
Oops, minimized a bit too much. Corrected test case:
```
import std;
struct S {
@safe:
int[3] front = [10, 20, 30];
bool empty = false;
void popFront() {empty = true;}
}
void main() @safe {
S.init.map!((return ref x)
On Friday, 7 February 2020 at 21:40:36 UTC, Steven Schveighoffer
wrote:
S.popFront is not @safe, and S is not a template. So no
inferrence.
Oops, minimized a bit too much. Corrected test case:
```
import std;
struct S {
@safe:
int[3] front = [10, 20, 30];
bool empty = false;
voi
On Fri, Feb 07, 2020 at 07:37:08PM +, mark via Digitalmars-d-learn wrote:
> I am porting code from other languages to D as part of learning D, and
> I find I've used sets quite a lot. AFAIK D doesn't have a built-in set
> type or one in the std. lib.
>
> However, I've been perfectly successful
On 2/7/20 4:17 PM, Dennis wrote:
On Friday, 7 February 2020 at 20:55:14 UTC, nullptr wrote:
Depending on how your range is structured, it might be possible to
just mark front as returning by ref to make this work.
That's a good one. I can't make front() return by ref, but I can make
front a m
On Friday, 7 February 2020 at 20:55:14 UTC, nullptr wrote:
Depending on how your range is structured, it might be possible
to just mark front as returning by ref to make this work.
That's a good one. I can't make front() return by ref, but I can
make front a member variable of the range struct
On Friday, 7 February 2020 at 20:31:47 UTC, Steven Schveighoffer
wrote:
The only solution I can provide is to wrap the static array
into a range (maybe something like this exists in Phobos?):
Thanks. I was hoping something like that existed in Phobos, but I
can't find anything.
On Friday, 7 February 2020 at 20:13:57 UTC, Dennis wrote:
If I have an input range with element type `int[3]`, how do I
easily turn it into a range of `int` so I can map it?
If it were an int[3][] I could simply cast it to an int[]
before mapping, but I don't want to eagerly turn it into an
arr
On 2/7/20 3:13 PM, Dennis wrote:
If I have an input range with element type `int[3]`, how do I easily
turn it into a range of `int` so I can map it?
If it were an int[3][] I could simply cast it to an int[] before
mapping, but I don't want to eagerly turn it into an array.
I thought of doing th
If I have an input range with element type `int[3]`, how do I
easily turn it into a range of `int` so I can map it?
If it were an int[3][] I could simply cast it to an int[] before
mapping, but I don't want to eagerly turn it into an array.
I thought of doing this:
```
range.map!(x => x[]).joine
On Friday, 7 February 2020 at 19:37:08 UTC, mark wrote:
I am porting code from other languages to D as part of learning
D, and I find I've used sets quite a lot. AFAIK D doesn't have
a built-in set type or one in the std. lib.
However, I've been perfectly successfully using int[E] where E
is
I am porting code from other languages to D as part of learning
D, and I find I've used sets quite a lot. AFAIK D doesn't have a
built-in set type or one in the std. lib.
However, I've been perfectly successfully using int[E] where E is
my ElementType, and adding with set[element] = 0. I mostl
Thanks for the excellent replies.
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote:
Some languages support this kind of thing:
if ((var x = expression) > 50)
print(x, " is > 50")
Is there anything similar in D?
Yes assuming that the expression is bool evaluable. This includes
- pointers: `if (auto p = giveMeSomePtr()
On Friday, 7 February 2020 at 18:10:07 UTC, bachmeier wrote:
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote:
Hi guys,
I am total newbie and trying to learn a little bit of
programming for personal purposes (web scrapping, small
databases for personal use etc.). I've been trying to i
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote:
Hi guys,
I am total newbie and trying to learn a little bit of
programming for personal purposes (web scrapping, small
databases for personal use etc.). I've been trying to install
any of IDE available, but had no success.
I use Manj
On Friday, 7 February 2020 at 17:02:18 UTC, solnce wrote:
Hi guys,
I am total newbie and trying to learn a little bit of
programming for personal purposes (web scrapping, small
databases for personal use etc.). I've been trying to install
any of IDE available, but had no success.
[...]
Tr
Hi guys,
I am total newbie and trying to learn a little bit of programming
for personal purposes (web scrapping, small databases for
personal use etc.). I've been trying to install any of IDE
available, but had no success.
I use Manjaro, so for the most task I use its AUR, where:
Dexed poin
On Friday, 7 February 2020 at 14:25:05 UTC, Jan Hönig wrote:
I am afraid that dlangui and dlangide is currently not
maintained, since i can reproduce the error as well.
If you're sure that's the case, then it should be pushed to the
inactive section on this page:
https://wiki.dlang.org/IDEs
On 2/7/20 2:34 AM, bauss wrote:
On Thursday, 6 February 2020 at 22:00:26 UTC, tchaloupka wrote:
On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote:
Hi all,
I'm create a small (hallo world) application, with DMD.
But my program create 7 annoying threads when create an empty class
On Friday, 7 February 2020 at 12:04:10 UTC, A.Perea wrote:
Hi,
I'm trying to compile dlangide, and it fails when compiling the
dependency dlangui. Trying to compile dlangui independently
gives the same error message (see below for full stack trace)
As phobos nor dlangui can be broken, it sho
Hi,
I'm trying to compile dlangide, and it fails when compiling the
dependency dlangui. Trying to compile dlangui independently gives
the same error message (see below for full stack trace)
As phobos nor dlangui can be broken, it should be something
related to wrong installation on my side?,
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote:
Some languages support this kind of thing:
if ((var x = expression) > 50)
print(x, " is > 50")
Is there anything similar in D?
Yes and no.
It only works for bools or things that convert to bool.
You might have seen:
string[string] d
Solved adding this code in resource.rc, converted to resource.res
and linked to .d source.
This code add the file "manifest.manifest" to resource.
1 24 "manifest.manifest"
Some languages support this kind of thing:
if ((var x = expression) > 50)
print(x, " is > 50")
Is there anything similar in D?
32 matches
Mail list logo