On Saturday, 12 November 2016 at 19:13:13 UTC, Nordlöw wrote:
0 => [0]
1 => [1,0]
2 => [1,1,0]
is easy but assumes a too extreme input value distribution.
Does anybody have a suggestion for an encoder that is more
suitable for real-world values that are, for instance, normally
distributed?
On 11/09/2016 07:46 AM, Is it possible to store different generic types?
via Digitalmars-d-learn wrote:
On Wednesday, 9 November 2016 at 15:44:59 UTC, Is it possible to store
different generic types? wrote:
Is it possible to store different generic types in ex. somekind of
container such as an a
On Saturday, 12 November 2016 at 19:13:13 UTC, Nordlöw wrote:
Does anybody have a suggestion for an encoder that is more
suitable for real-world values that are, for instance, normally
distributed?
I don't recall the name, but there is an algorithm for encoding
data of an arbitrary number of
I'm looking for libraries/snippets (either in D or similar
languages) that perform variable-length encoding of unsigned
integers onto a bit-stream. Requirement is that smaller inputs
(integer values) should be encoded with equal or fewer bits.
This
0 => [0]
1 => [1,0]
2 => [1,1,0]
is easy bu
On Saturday, 12 November 2016 at 19:13:13 UTC, Nordlöw wrote:
Does anybody have a suggestion for an encoder that is more
suitable for real-world values that are, for instance, normally
distributed?
Doh, forget the normal distribution thing here. It, of course,
doesn't work with unsigned integ
On Wednesday, 9 November 2016 at 15:44:59 UTC, Is it possible to
store different generic types? wrote:
Foo[] foos; // Where Foo of course should allow any generic
version of Foo
You can use an array of std.variant
On Saturday, 12 November 2016 at 13:11:02 UTC, Mike Parker wrote:
void func2(int[] foo) { foo ~= 10; }
Sorry, this should be (ref int[] foo)
On Saturday, 12 November 2016 at 12:16:02 UTC, Andrew wrote:
Bear in mind that static arrays are implicitly sliced when
passed to or returned from a function anywhere a dynamic array
is expected. If you modify f() to look like this:
int[] f()
{
int[10] sa;
foreach(int i, ref sa_i;sa){
On Saturday, 12 November 2016 at 11:03:31 UTC, Mike Parker wrote:
[...]
You *have* created a dangling pointer. It's just that for such
a simple little program, the part of the stack where the
original array was allocated isn't stomped at the point where
you access it after the function call.
On Saturday, 12 November 2016 at 11:03:31 UTC, Mike Parker wrote:
Thank you very much for your clarifications & explanations, I am
reassured to see that things work like in C.
I will also look the links you provided, thank you again for your
time.
Vincent
Thank you for your answer cym13.
I reproduced your result for:
On Saturday, 12 November 2016 at 10:45:23 UTC, cym13 wrote:
void f_test() {
auto sb=f();
sb[2] = 100;
writeln(sb[2]); // prints 100
int test[100];
writeln(sb[2]); // prints 0
}
now I am convinced of the invalid
On Saturday, 12 November 2016 at 10:33:05 UTC, Picaud Vincent
wrote:
Hi all,
Still learning... This time what surprised me is how static
arrays work.
I assume (is it true?) that for efficiency reason static size
arrays like int[10] are on the stack and do not involve dynamic
memory allocation:
On Saturday, 12 November 2016 at 10:33:05 UTC, Picaud Vincent
wrote:
Hi all,
Still learning... This time what surprised me is how static
arrays work.
I assume (is it true?) that for efficiency reason static size
arrays like int[10] are on the stack and do not involve dynamic
memory allocation:
Hi all,
Still learning... This time what surprised me is how static
arrays work.
I assume (is it true?) that for efficiency reason static size
arrays like int[10] are on the stack and do not involve dynamic
memory allocation:
First surprise: it is possible to share a static array:
void main(
14 matches
Mail list logo