As @David already said, as far as your question is concerned, there's no such thing as "making assumptions". The literals simply have types, which are the types that a function template may use for type deduction. Remember that conversions considered as part of the template matching, though!
So, let's say you have this function template:
template <typename T> void foo(T x, T y);
Then if you call foo(1, 2)
, this will be called with T = int
.
If you say foo(1u, 2u)
, the deduction is T = unsigned int
.
If you say anything mixed like foo(1u, 2)
, there is no preferred match and the compiler will report an error.
Since there is no short
literal in C or C++, if you want to explicitly call the function foo<short>
, you can either say so, or create temporary explicitshort
arguments:
foo<short int>(3, 4);
foo<short int>(3u, 4l); // also OK because of conversion
foo(short(3), short(4)); // deduction
Update: In light of your edit, note that since you're only matching one argument per template parameter, you won't have any trouble with ambiguous matching.