Lars T. Kyllingstad wrote:
Looks like you ran into a piece of hopelessly outdated documentation.
The correct names are, in the same order:
Thanks, I'll fix.
strtr:
>Might this be worth an explicit mention on digitalmars?<
Currently the documentation has some semantic holes that must be filled :-)
> Suppose I'd still would like to use void optimizations, how do you clear the
> holes manually?
If you need to fill the holes manually, then probably it
The situation is ugly, see the post in the main newsgroup:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=107153
Bye,
bearophile
strtr:
> static if( S.sizeof == members.sizeof )
> S s = void;
> else
> S s;
You can use something like this :-)
import std.stdio: writeln;
int unusedBytesStruct(S)() if (is(S == struct)) {
int totUsed;
foreach (field; S.init.tupleof)
totUsed += field.sizeof;
return cast(in
Hello.
In D1, this code fails:
void foo(S)(ref S s){
foreach(ref k; s.tupleof){
k = 1;
}
}
struct K{
int g;
}
void main(){
K k;
foo(k);
assert(k.g == 1);
}
test.d(5): Error: no storage class for value k
(referring to 'k = 1;')
Is this an expected error, and is there a good
On 3/7/10 19:11, Ellery Newcomer wrote:
Hello.
In D1, this code fails:
void foo(S)(ref S s){
foreach(ref k; s.tupleof){
k = 1;
}
}
struct K{
int g;
}
void main(){
K k;
foo(k);
assert(k.g == 1);
}
test.d(5): Error: no storage class for value k
(referring to 'k = 1;')
Is this an expected er
On 03/07/2010 12:23 PM, Jacob Carlborg wrote:
On 3/7/10 19:11, Ellery Newcomer wrote:
Hello.
In D1, this code fails:
void foo(S)(ref S s){
foreach(ref k; s.tupleof){
k = 1;
}
}
struct K{
int g;
}
void main(){
K k;
foo(k);
assert(k.g == 1);
}
test.d(5): Error: no storage class for value k
This problem might have been raised before, but I can't why this doesn't
compile (except the last line), while a non-template version of the same
code works well. Is this a bug?
---
module test;
template Graph(T)
{
alias T[][T] Graph;
}
void add_edge(T)(ref Graph!(T) graph, T source, T ta
biozic:
> This problem might have been raised before, but I can't why this doesn't
> compile (except the last line), while a non-template version of the same
> code works well. Is this a bug?
I don't know why your code doesn't work, someone more expert than me can answer
you. Maybe it's a bug.