Greetings,

In some cases it would be useful to overload functions based on knowing if a variable is a compile-time constant or not. For example:

void foo(int size)
{
    cout << 1 << endl;
}

template <int Size>
    void foo(int Size)
    {
        cout << 2 << endl;
    }

int main(int argc, char * argv[])
{
    foo(argc); // outputs 1
    foo(sizeof(int)); // outputs 2
}


Regards,

--

Phil Bouchard

Founder
C.: (819) 328-4743

Fornux Logo