Re: OpenMAX bindings

2017-08-30 Thread Francis Nixon via Digitalmars-d-learn

On Friday, 25 August 2017 at 03:34:00 UTC, Johnson wrote:

Anyone?


Since OpenMAX provides header files you can convert them to d 
using this: https://dlang.org/htod.html


You can then link your d code with OpenMAX.



Transitive const and function pointers/delegates

2017-08-29 Thread Francis Nixon via Digitalmars-d-learn
I was wondering how transitive const applies to functions. For 
example would the following declaration:


const int delegate(char)

be equivalent to:

const(int) delegate(char) // I think its this one

or:

const(int) delegate(const(char))

Would it be different for function instead of delegate?


Re: Missing array element

2017-08-29 Thread Francis Nixon via Digitalmars-d-learn

On Tuesday, 29 August 2017 at 18:20:38 UTC, Vino.B wrote:

Hi,

 Can any one help me on the below program, as I need the 
missing element for array "a" to be printed when compared with 
array "b"


Program:

import std.stdio, std.array, std.algorithm;
string[] a = ["test1", "test2", "test4"];
string[] b = ["test2", "test4"];
void main ()
{
auto m = mismatch(a,b);
writeln(m[0]);
writeln(m[1]);
}

Output:
["test1", "test2", "test4"]
["test2", "test4"]

Required output: "test1"

From,
Vino.B


The mismatch function doesn't work how your expecting it to. It 
compares the ith element in a with the ith element in b, until 
they encounter an element that is not equal. It then returns all 
elements including and beyond i, for both arrays. In this case 
the first element does not match, and therefore it returns the 
entire contents of both arrays.


Strange expression found in std.variant

2017-06-03 Thread Francis Nixon via Digitalmars-d-learn

When looking at std.variant I found the following line:
return q{
static if (allowed!%1$s && T.allowed!%1$s)
 if (convertsTo!%1$s && other.convertsTo!%1$s)
 return VariantN(get!%1$s %2$s other.get!%1$s);
}.format(tp, op);

I was wondering what exactly the % signs where doing/what they 
are for?