Returning reference to an array of specific size without explicitly stating the size in return type

Viewed 1279

I've got the following function:

... getX()
{
    static int x[] = {1, 2, 3};
    return x;
}

I'd like to have it's return type as int(&)[3] but don't wan't to specify the size (3) explicitly.

How do I do that?

(Please don't ask why do I want that.)

UPD

Well, OK, I need to pass a result to a template function taking int(&x)[N] as a parameter (and I don't want to pass the size explicitly to that template function), so I don't see how a solution with returning a pair could work...

4 Answers
Related