I'm making an equivalent of "sgn" function of BASIC language, and I used "(T)" in its definition, but the function can receive wrong data by passing string data to it, how we can solve it?

int sgn(T)(T x)
{

    if(x<0)
        return -1;
    else if(x>0)
        return 1;
    else
        return 0;

}

Reply via email to