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 11:11

why not try learning the language instead of guessing

Name: Anonymous 2013-09-21 12:16

>>2
But I'm learning.

Name: Anonymous 2013-09-21 12:19

>>3
You're trying kashira.

Name: Anonymous 2013-09-22 1:12

I'm having trouble with 4chanX on firefox. It seems to have uninstalled itself and when I try to reinstall from github I just get a text file. Anyone know how to fix this? Please help.

Name: Anonymous 2013-09-22 1:27

>>5
Read SICP.

Name: Anonymous 2013-09-22 1:29

install gentoo

Name: Anonymous 2013-09-22 1:44

why no std::array

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