On 7/30/20 4:42 PM, wjoe wrote:
> So .capacity can't be assigned a value like length to reserve the RAM ?
Yes, a read-only property...
>> auto a = b;
>> b = b[0 .. $-1];
>> b ~= someT;
>>
>> If that last line is done in-place, then it overwrites a[$-1].
>
> So this is a case of sharing being
On Thursday, 30 July 2020 at 16:33:22 UTC, Ali Çehreli wrote:
On 7/30/20 8:58 AM, wjoe wrote:
b.reserve(n);
b.length = n;
There may be something that I don't know but I think assigning
to the .length property alone should be the same as reserving
and then assigning.
On Thu, Jul 30, 2020 at 06:52:42PM +, sportsracer via Digitalmars-d-learn
wrote:
[...]
> int[] xs = new int[100];
> const chunked = xs.chunks(10);
> writeln(chunked[0][0]);
> }
>
> Error: mutable method std.range.Chunks!(int[]).Chunks.opIndex is not
> callable using a const
Newcomer to the D language here. I was going to use
`std.range.chunks` to get a two-dimensional, read-only view on
data in one continuous array.
But was surprised to find that this code doesn't compile:
import std.range : chunks;
import std.stdio : writeln;
void main()
{
int[] xs = new
On Thursday, 30 July 2020 at 15:58:28 UTC, wjoe wrote:
I just stumbled upon code like this:
struct Foo(T)
{
T[] b;
this(int n)
{
b.reserve(n);
b.length = n;
}
}
.reserve looks redundant.
The docs are explaining .length nicely, however lack any
specifics about
On 7/30/20 11:58 AM, wjoe wrote:
I just stumbled upon code like this:
struct Foo(T)
{
T[] b;
this(int n)
{
b.reserve(n);
b.length = n;
}
}
..reserve looks redundant.
It is, in this case. Reserve will extend the allocated length to n, but
not adjust the
On 7/30/20 8:58 AM, wjoe wrote:
b.reserve(n);
b.length = n;
There may be something that I don't know but I think assigning to the
.length property alone should be the same as reserving and then assigning.
reserve is supposed to make sure no memory will be allocated as
I just stumbled upon code like this:
struct Foo(T)
{
T[] b;
this(int n)
{
b.reserve(n);
b.length = n;
}
}
.reserve looks redundant.
The docs are explaining .length nicely, however lack any
specifics about reserve.
Changing the length of an array may relocate
On Thu, Jul 30, 2020 at 01:41:05PM +, Oleg B via Digitalmars-d-learn wrote:
[...]
> Logically we can compare versions, but what must return `opCmp` if one of
> versions has 'not comparible' state?
[...]
opCmp is allowed to return float; so you could return float.nan in this
case.
T
--
Hello!
For example we can imagine struct Version.
Version can be old or new and can be 'badly formed' or
'undefined' or other 'not comparible' ('uncompatible') state.
Logically we can compare versions, but what must return `opCmp`
if one of versions has 'not comparible' state?
I think
On Thursday, 30 July 2020 at 12:28:08 UTC, Adam D. Ruppe wrote:
On Thursday, 30 July 2020 at 12:22:46 UTC, aberba wrote:
[...]
I don't think I wrote it as a library yet, but the idea is
pretty simple: they all start with "data:" so you look for that.
Then there's a type after that, so you
On Thursday, 30 July 2020 at 12:22:46 UTC, aberba wrote:
I'm able to decode it to a buffer but the trouble is getting it
from buffer to an actual image file. Any library function
combination I can use?
I don't think I wrote it as a library yet, but the idea is pretty
simple: they all start
So I have a base64 image url string and I'm trying to generate a
png,jpg image file from it.
I'm able to decode it to a buffer but the trouble is getting it
from buffer to an actual image file. Any library function
combination I can use?
On Monday, 27 July 2020 at 16:58:13 UTC, H. S. Teoh wrote:
On Mon, Jul 27, 2020 at 11:39:32AM +, John Burton via
Digitalmars-d-learn wrote: [...]
I tried looking there for information and examples of getting
glfw3 statically linked into my program using LDC and didn't
really find anything.
On Tuesday, 28 July 2020 at 06:57:36 UTC, Cecil Ward wrote:
I read recently that all asm in D is regarded as ‘volatile’ in
the GCC sense, which I take to mean that it is assume to
potentially have side effects, and so cannot be optimised away
to nothing by the compiler despite the lack of any
15 matches
Mail list logo