August 12, 2010 Re: A const idiom + a different 'delete' | ||||
---|---|---|---|---|
| ||||
bearophile Wrote:
> void main() {
> int[int] aa_;
> foreach (i; 0 .. 10)
> aa_[i] = i * i;
>
> // now I'd like to freeze aa
> const(int[int]) aa = aa_;
> }
>
void f()
{
{
int[int] aa;
//fill
g(aa);
}
void g(ref const int[int] bb)
{
//do stuff
}
}
|
Copyright © 1999-2021 by the D Language Foundation