A const idiom + a different 'delete'

Adam Ruppe destructionator at gmail.com
Wed Aug 11 11:27:19 PDT 2010


Here's how I'd do it:

void main() {
    const T[] buildArray() {
          T[] t;
          // fill in t

           return t;
    }

   const T[] t = buildArray;
}

So the creation is factored away into that nested function which is
used to initialized the reference that you keep around.


More information about the Digitalmars-d mailing list