On 8/24/21 1:44 PM, Ferhat Kurtulmuş wrote:
> Just out of curiosity, if a range implementation uses malloc in save, is
> it only possible to free the memory with the dtor?
Yes but It depends on the specific case. For example, if the type has a
clear() function that does clean up, then one
On 8/24/21 2:12 PM, frame wrote:
You can call `popFront` if you need to after the loop, or just before
the break. I have to say, the term "useless" does not even come close
to describing ranges using foreach in my experience.
I disagree, because foreach() is a language construct and therefore
On Tuesday, 24 August 2021 at 19:06:44 UTC, Alexandru Ermicioi
wrote:
On Tuesday, 24 August 2021 at 09:15:23 UTC, bauss wrote:
[...]
Actually the range contracts don't mention that it needs to be
a by value type. It can also be a reference type, i.e. a class.
[...]
True for any forward
On Tuesday, 24 August 2021 at 09:15:23 UTC, bauss wrote:
A range should be a struct always and thus its state is copied
when the foreach loop is created.
Actually the range contracts don't mention that it needs to be a
by value type. It can also be a reference type, i.e. a class.
Which
On Tuesday, 24 August 2021 at 08:36:18 UTC, frame wrote:
How do you handle that issue? Are your ranges designed to have
this bug or do you implement opApply() always?
This is expected behavior imho. I think what you need is a
forward range, not input range. By the contract of input range,
it
On Tuesday, 24 August 2021 at 16:45:27 UTC, H. S. Teoh wrote:
In some cases, you *want* to retain the same element between
loops, e.g., if you're iterating over elements of some category
and stop when you encounter something that belongs to the next
category -- you wouldn't want to consume
On Tuesday, 24 August 2021 at 13:02:38 UTC, Steven Schveighoffer
wrote:
On 8/24/21 4:36 AM, frame wrote:
Consider a simple input range that can be iterated with
empty(), front() and popFront(). That is comfortable to use
with foreach() but what if the foreach loop will be cancelled?
If a
On Tue, Aug 24, 2021 at 08:36:18AM +, frame via Digitalmars-d-learn wrote:
> Consider a simple input range that can be iterated with empty(),
> front() and popFront(). That is comfortable to use with foreach() but
> what if the foreach loop will be cancelled? If a range isn't depleted
> yet
On Tuesday, 24 August 2021 at 11:52:45 UTC, Dennis wrote:
On Saturday, 21 August 2021 at 08:14:22 UTC, Виталий Фадеев
wrote:
Any more ?
CPP2D
https://github.com/lhamot/CPP2D
Dennis, thank!
On 8/24/21 4:36 AM, frame wrote:
Consider a simple input range that can be iterated with empty(), front()
and popFront(). That is comfortable to use with foreach() but what if
the foreach loop will be cancelled? If a range isn't depleted yet and
continued it will supply the same data twice on
On Saturday, 21 August 2021 at 08:14:22 UTC, Виталий Фадеев wrote:
Any more ?
CPP2D
https://github.com/lhamot/CPP2D
On Tuesday, 24 August 2021 at 09:45:31 UTC, JG wrote:
On Tuesday, 24 August 2021 at 09:42:29 UTC, JG wrote:
On Tuesday, 24 August 2021 at 09:36:06 UTC, JG wrote:
[...]
In case anyone is interested it seems that it was forked to
here:
https://github.com/joakim-brannstrom/profdump
Perhaps
On Tuesday, 24 August 2021 at 09:26:20 UTC, jfondren wrote:
I think you strayed from the beaten path, in a second way, as
soon as your range's lifetime escaped a single expression, to
be possibly used in two foreach loops. With ranges, as you do
more unusual things, you're already encouraged
On Tuesday, 24 August 2021 at 09:15:23 UTC, bauss wrote:
A range should be a struct always and thus its state is copied
when the foreach loop is created.
This is not conform with the aggregate expression mentioned in
the manual where a class object would be also allowed.
Which means the
On Tuesday, 24 August 2021 at 09:42:29 UTC, JG wrote:
On Tuesday, 24 August 2021 at 09:36:06 UTC, JG wrote:
On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote:
[...]
I tried to do this, but I am not sure how to install profdump.
What I did is cloned the repository using git.
Tried to
On Tuesday, 24 August 2021 at 09:36:06 UTC, JG wrote:
On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote:
[...]
I tried to do this, but I am not sure how to install profdump.
What I did is cloned the repository using git.
Tried to build it using dub but got an error as described here:
On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote:
On Wednesday, 10 February 2021 at 11:52:51 UTC, JG wrote:
As a follow up question I would like to know what tool people
use to profile d programs?
I use this one:
https://code.dlang.org/packages/profdump
e.g.
```
dub build
On Tuesday, 24 August 2021 at 08:36:18 UTC, frame wrote:
Consider a simple input range that can be iterated with
empty(), front() and popFront(). That is comfortable to use
with foreach() but what if the foreach loop will be cancelled?
If a range isn't depleted yet and continued it will supply
On Tuesday, 24 August 2021 at 08:36:18 UTC, frame wrote:
Consider a simple input range that can be iterated with
empty(), front() and popFront(). That is comfortable to use
with foreach() but what if the foreach loop will be cancelled?
If a range isn't depleted yet and continued it will supply
Consider a simple input range that can be iterated with empty(),
front() and popFront(). That is comfortable to use with foreach()
but what if the foreach loop will be cancelled? If a range isn't
depleted yet and continued it will supply the same data twice on
front() in the next use of
On Tuesday, 24 August 2021 at 05:34:08 UTC, Ali Çehreli wrote:
On 8/23/21 10:25 PM, james.p.leblanc wrote:
So, you need a "property". Easy... :)
1) Rename the member e.g. as a_.
2) Write setter and getter functions named 'a'.
struct Foo{
int a_;
int a() const {
return a_;
}
21 matches
Mail list logo