On the D2 online pages
(http://www.digitalmars.com/d/2.0/statement.html#ForeachStatement)there
is
Foreach over Structs and Classes with Ranges
My question is , is there a working example of foreach ( e ; range )?
Iteration over struct and class objects can be done with ranges, which
Michael Rynn wrote:
On the D2 online pages
(http://www.digitalmars.com/d/2.0/statement.html#ForeachStatement)there
is
Foreach over Structs and Classes with Ranges
My question is , is there a working example of foreach ( e ; range )?
Iteration over struct and class objects can be done
Lars T. Kyllingstad wrote:
Michael Rynn wrote:
On the D2 online pages
(http://www.digitalmars.com/d/2.0/statement.html#ForeachStatement)there
is
Foreach over Structs and Classes with Ranges
My question is , is there a working example of foreach ( e ; range )?
Iteration over struct and
I got 2 classes which both (indirectly) inherit from a common base class and
implement a certain interface I.
Now I need to pass that interface to a function and need to call a function
inherited from the base class inside.
Naturally that function is not present in the interface and thus can't
Trass3r:
I got 2 classes which both (indirectly) inherit from a common base class and
implement a certain interface I.
When possible show an example. You can fill/fix the following code to create an
example of your problem:
interface IFoo {
void foo();
}
class Base {
void foo() {}
}
div0:
Yeah, I *never* access static vars through an instance,
I always use the class name.
Somebody want to post in the main group?
It seems there are few people that agree with you, but Walter has not answered
about this yet, so you can ask him his opinion. I like to use a tidy language.
On 3/6/10 13:39, Trass3r wrote:
I got 2 classes which both (indirectly) inherit from a common base class and
implement a certain interface I.
Now I need to pass that interface to a function and need to call a function
inherited from the base class inside.
Naturally that function is not
Lars T. Kyllingstad pub...@kyllingen.nospamnet wrote in message
news:hmnu5l$31j...@digitalmars.com...
3. It's sometimes unclear which symbols are members of a class/struct
and which are module-level symbols. Tango's API documentation is better
in this regard, since it has the symbol tree
Good range documentation comes from:
http://digitalmars.com/d/2.0/phobos/std_range.html
foreach only requires an Input Range.
Cast the instance to the base class and call the method?
Surprisingly this does compile.
What are the rules for casting between classes?
This is probably going a bit above my head, but
the existence of alignment holes in the objects is accounted for, usually by
setting them all to 0 upon initialization
I suspect this isn't the case for void initialization; if my struct has some
alignment hole I better not void initialize it if
strtr:
I suspect this isn't the case for void initialization; if my struct has some
alignment hole I better not void initialize it if ever I want to compare it
with somthing.
Is this correct?
That has to be correct.
Would you ever have an alignment hole if all the struct contains are
Hello Strtr,
Would you ever have an alignment hole if all the struct contains are
basic types(excluding bool)?
real, char[n], byte[n] and short[m] (for n%4 != 0 and m%2 != 0) might be
an issue.
--
... IXOYE
BCS Wrote:
Hello Strtr,
Would you ever have an alignment hole if all the struct contains are
basic types(excluding bool)?
real, char[n], byte[n] and short[m] (for n%4 != 0 and m%2 != 0) might be
an issue.
Sounds logical, thanks!
Hello Strtr,
BCS Wrote:
Hello Strtr,
Would you ever have an alignment hole if all the struct contains are
basic types(excluding bool)?
real, char[n], byte[n] and short[m] (for n%4 != 0 and m%2 != 0) might
be an issue.
Sounds logical, thanks!
I don't actually *know* those will be a
bearophile Wrote:
strtr:
I suspect this isn't the case for void initialization; if my struct has
some alignment hole I better not void initialize it if ever I want to
compare it with something.
Is this correct?
That has to be correct.
Might this be worth an explicit mention on
Hello Strtr,
Suppose I'd still would like to use void optimizations, how do you
clear the holes manually?
IIRC zero filling a block is likely cheaper that zero filling holes in it.
I'd avoid =void unless you know you will be copying structs into the space
(that will copy the holes as
17 matches
Mail list logo