Thanks everyone for the comments. (It will probably be used when using arr on the heap, as well as when throwing when calling a function). celtschk ref, was very helpful. I will use this information for a local non-static array in the same area
int main() { int foo[] = { 16, 2, 77, 40, 12071 }; int size = sizeof(foo)/ sizeof(int); try{ //throw foo; throw (pair<int*,int>(foo,size)); } catch (int* foo) { for (int i = 0; i < size; i++) cout << foo[i] << ","; } catch (pair<int*, int>& ip) { cout << "pair.." << endl; for (int i = 0; i < ip.second; i++) cout << ip.first[i] << ","; } cout << endl; }
source share