Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Return member array by reference

Name: Anonymous 2013-09-21 10:56

How can I use a function like this?


template <int T>
const int (&getNumbers() const)[T]
{
    return this->numbers;
}


int main (int argv, char* args[])
{
    Test t;
    int a[] = {1, 2, 3};
    t.setNumbers(a);//Works
    printf("%d\n", t.getNumbers()[0]);//Doesn't work
    return 0;
}

Name: Anonymous 2013-09-21 12:16

>>2
But I'm learning.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List