Specify default template argument

Viewed 121

Assume I have a template function like:

template<typename T, typename DType=uint32_t>
void fun(T a) {
    //...
    // DType is used inside
}

How can I specify the type of DType, but let T be deduced by the compiler, something like:

fun<DType=int32_t>(static_cast<std::string>(s));
2 Answers
Related