Sean Cavanaugh:
> Is there any way to access the your current scope? For instance the
> following pseudocode is what I am after more or less:
>
>
> class Foo
> {
>alias byte function(int) BarCompatibleInterface;
>
>byte Bar(int)
>{
> static assert(is(typeof(localscope) == fun
Is there any way to access the your current scope? For instance the
following pseudocode is what I am after more or less:
class Foo
{
alias byte function(int) BarCompatibleInterface;
byte Bar(int)
{
static assert(is(typeof(localscope) == function));
static assert(is(std.traits.
Yeah I basically took the idea from the existing D implementation.
Although D's arrays are a struct with a length and a pointer (I think
so).
simendsjo:
> int[3] a = [1,2,4];
> float[3] b = [1,2,4];
> float[3] c;
> // Why doesn't this work?
> c = a[] + b[]; // Error: incompatible types for ((a[]) + (b[])):
> 'int[]' and 'float[]'
> // When this works?
> c[0] = a[0] + b[0];
> c[1] = a[1] + b[1]
%u wrote:
is there any different b/w:
auto arr = new int[10];
arr is dynamic array of int with ten elements
and
int[10] arr;
?
arr is static array of int with ten elements
is there any different b/w:
auto arr = new int[10];
and
int[10] arr;
?
On 16.04.2011 12:12, simendsjo wrote:
int[3] a = [1,2,4];
float[3] b = [1,2,4];
float[3] c;
// Why doesn't this work?
c = a[] + b[]; // Error: incompatible types for ((a[]) + (b[])): 'int[]'
and 'float[]'
// When this works?
c[0] = a[0] + b[0];
c[1] = a[1] + b[1];
c[2] = a[2] + b[2];
assert(c ==
int[3] a = [1,2,4];
float[3] b = [1,2,4];
float[3] c;
// Why doesn't this work?
c = a[] + b[]; // Error: incompatible types for ((a[]) + (b[])):
'int[]' and 'float[]'
// When this works?
c[0] = a[0] + b[0];
c[1] = a[1] + b[1];
c[2] = a[2] + b[2];
assert(
On 04/16/2011 06:55 AM, Andrej Mitrovic wrote:
I wonder.. in all these years.. have they ever thought about using a
convention in C where the length is embedded as a 32/64bit value at
the pointed location of a pointer, followed by the array contents?
Sometimes called "Pascal strings" (actually,